pub struct GraphQLError {
pub message: String,
pub locations: Option<Vec<ErrorLocation>>,
pub path: Option<Vec<PathSegment>>,
pub extensions: Option<HashMap<String, Value>>,
pub code: ErrorCode,
}Expand description
GraphQL error
Fields§
§message: StringError message
locations: Option<Vec<ErrorLocation>>Error locations in the query
path: Option<Vec<PathSegment>>Path to the field that caused the error
extensions: Option<HashMap<String, Value>>Error extensions
code: ErrorCodeError code
Implementations§
Source§impl GraphQLError
impl GraphQLError
Sourcepub fn parse_error(message: impl Into<String>) -> Self
pub fn parse_error(message: impl Into<String>) -> Self
Create a parse error
Sourcepub fn validation_error(message: impl Into<String>) -> Self
pub fn validation_error(message: impl Into<String>) -> Self
Create a validation error
Create an authorization error
Sourcepub fn with_location(self, line: u32, column: u32) -> Self
pub fn with_location(self, line: u32, column: u32) -> Self
Set location
Sourcepub fn with_path(self, path: Vec<PathSegment>) -> Self
pub fn with_path(self, path: Vec<PathSegment>) -> Self
Set path
Sourcepub fn with_extension(self, key: impl Into<String>, value: Value) -> Self
pub fn with_extension(self, key: impl Into<String>, value: Value) -> Self
Add extension
Trait Implementations§
Source§impl Clone for GraphQLError
impl Clone for GraphQLError
Source§fn clone(&self) -> GraphQLError
fn clone(&self) -> GraphQLError
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for GraphQLError
impl Debug for GraphQLError
Source§impl Display for GraphQLError
impl Display for GraphQLError
Source§impl Error for GraphQLError
impl Error for GraphQLError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0:
use the Display impl or to_string()
Auto Trait Implementations§
impl Freeze for GraphQLError
impl RefUnwindSafe for GraphQLError
impl Send for GraphQLError
impl Sync for GraphQLError
impl Unpin for GraphQLError
impl UnsafeUnpin for GraphQLError
impl UnwindSafe for GraphQLError
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoAnyhow for T
impl<T> IntoAnyhow for T
Source§fn into_anyhow(self) -> Error
fn into_anyhow(self) -> Error
Converts
self into an anyhow::Error.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more