Skip to main content

graphql_error

Function graphql_error 

Source
pub fn graphql_error(
    code: &str,
    message: impl Into<String>,
    status: Option<u16>,
) -> Error
Expand description

Build a coded GraphQL error: extensions.code and, when given, extensions.status.

use autumn_plugin_graphql::error::{codes, graphql_error};

let err = graphql_error(codes::NOT_FOUND, "no such note", Some(404));
assert_eq!(err.message, "no such note");