Struct apollo_router::graphql::Error
source · #[non_exhaustive]pub struct Error {
pub message: String,
pub locations: Vec<Location>,
pub path: Option<Path>,
pub extensions: Map<ByteString, Value>,
}Expand description
A GraphQL error
as may be found in the errors field of a GraphQL Response.
Converted to (or from) JSON with serde.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.message: StringThe error message.
locations: Vec<Location>The locations of the error in the GraphQL document of the originating request.
path: Option<Path>If this is a field error, the JSON path to that field in Response::data
extensions: Map<ByteString, Value>The optional GraphQL extensions for this error.
Implementations§
source§impl Error
impl Error
sourcepub fn builder<T: Into<String>>() -> NewErrorBuilder<T>
pub fn builder<T: Into<String>>() -> NewErrorBuilder<T>
Returns a builder that builds a GraphQL Error from its components.
Builder methods:
-
.message(impl Into<String>)Required. SetsError::message. -
.locations(impl Into<Vec<Location>>)Optional. Sets the entireVecofError::locations, which defaults to the empty. -
.location(impl Into<Location>)Optional, may be called multiple times. Adds one item at the end ofError::locations. -
.path(impl Into<Path>)Optional. SetsError::path. -
.extensions(impl Into<serde_json_bytes::Map<ByteString,Value>>)Optional. Sets the entireError::extensionsmap, which defaults to empty. -
.extension(impl Into<ByteString>, impl Into<Value>)Optional, may be called multiple times. Adds one item to theError::extensionsmap. -
.build()Finishes the builder and returns a GraphQLError.
Trait Implementations§
source§impl<'de> Deserialize<'de> for Error
impl<'de> Deserialize<'de> for Error
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
source§impl From<PlannerError> for Error
impl From<PlannerError> for Error
source§fn from(err: PlannerError) -> Self
fn from(err: PlannerError) -> Self
source§impl From<WorkerError> for Error
impl From<WorkerError> for Error
source§fn from(err: WorkerError) -> Self
fn from(err: WorkerError) -> Self
source§impl From<WorkerGraphQLError> for Error
impl From<WorkerGraphQLError> for Error
source§fn from(err: WorkerGraphQLError) -> Self
fn from(err: WorkerGraphQLError) -> Self
source§impl PartialEq for Error
impl PartialEq for Error
impl Eq for Error
impl StructuralPartialEq for Error
Auto Trait Implementations§
impl Freeze for Error
impl RefUnwindSafe for Error
impl Send for Error
impl Sync for Error
impl Unpin for Error
impl UnwindSafe for Error
Blanket Implementations§
source§impl<T> Serialize for T
impl<T> Serialize for T
fn erased_serialize(&self, serializer: &mut dyn Serializer) -> Result<Ok, Error>
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
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.source§impl<T> FutureExt for T
impl<T> FutureExt for T
source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
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> 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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Requestsource§impl<T> Serializable for Twhere
T: Serialize,
impl<T> Serializable for Twhere
T: Serialize,
source§impl<T> StdoutFmt for Twhere
T: Display,
impl<T> StdoutFmt for Twhere
T: Display,
source§impl<T> Variant for T
impl<T> Variant for T
source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Variant trait object to &mut dyn Any.source§fn as_boxed_any(self: Box<T>) -> Box<dyn Any>
fn as_boxed_any(self: Box<T>) -> Box<dyn Any>
Variant trait object to Box<dyn Any>.