Enum warpgrapher::Error
source · [−]pub enum Error {
Show 32 variants
ClientRequestFailed {
source: Error,
},
ConfigItemDuplicated {
type_name: String,
},
ConfigItemReserved {
type_name: String,
},
ConfigOpenFailed {
source: Error,
},
ConfigVersionMismatched {
expected: i32,
found: i32,
},
DatabaseNotFound,
JsonDeserializationFailed {
source: Error,
},
EnvironmentVariableNotFound {
name: String,
},
EnvironmentVariableBoolNotParsed {
source: ParseBoolError,
},
EnvironmentVariableIntNotParsed {
source: ParseIntError,
},
EventError {
source: Box<dyn Error + Sync + Send>,
},
InputItemNotFound {
name: String,
},
InvalidHeaderName {
source: InvalidHeaderName,
},
InvalidHeaderValue {
source: InvalidHeaderValue,
},
LabelNotFound,
PartitionKeyNotFound,
PayloadNotFound {
response: Value,
},
RelDuplicated {
rel_name: String,
ids: String,
},
ResolverNotFound {
name: String,
},
ResponseSetNotFound,
ResponseItemNotFound {
name: String,
},
SerializationFailed {
source: Error,
},
SchemaItemNotFound {
name: String,
},
ThreadCommunicationFailed {
source: RecvError,
},
TransactionFinished,
TypeConversionFailed {
src: String,
dst: String,
},
TypeNotExpected {
details: Option<String>,
},
UserDefinedError {
source: Box<dyn Error + Sync + Send>,
},
UuidNotParsed {
source: Error,
},
ValidationFailed {
message: String,
},
ValidatorNotFound {
name: String,
},
YamlDeserializationFailed {
source: Error,
},
}
Expand description
Error type for Warpgrapher
Examples
use serde_json::json;
use warpgrapher::Error;
let e = Error::PayloadNotFound { response: json!{"surprise"} };
Variants
ClientRequestFailed
Fields
source: Error
Returned if a Client
is unable to submit a request to the server, such as due to a
network or server error, or the response cannot be parsed as valid JSON. Inspect the
reqwest::Error
included as a source error for additional detail.
ConfigItemDuplicated
Fields
type_name: String
Returned if two Warpgrapher endpoints or two Warpgrapher types are defined with the same
name. The type_name
field contains the name of the duplicated type.
ConfigItemReserved
Fields
type_name: String
Returned if a Warpgrapher endpoint or type is defined with a name that is a reserved
word, such as “ID” or a GraphQL scalar. The field type_name
is the name that triggered the
error.
ConfigOpenFailed
Fields
source: Error
Returned if a Config
file cannot be opened, typically because the configuration file
cannot be found on disk
ConfigVersionMismatched
Returned if attempting to compose configs with different versions. The field expected
contains the version of the base Config
, and found
contains the version of the Config
being merged in.
DatabaseNotFound
Returned if the engine is configured to operate without a database. Typically this would never be done in production
JsonDeserializationFailed
Fields
source: Error
Returned if a serde_json::Value
struct fails to deserialize into a struct
EnvironmentVariableNotFound
Fields
name: String
Returned if an environment variable cannot be found. The name
field contains the name of
the environment variable that could not be found.
EnvironmentVariableBoolNotParsed
Fields
source: ParseBoolError
Returned if an environemtn variable for a boolean flag cannot be parsed from the environment variable string into a bool
EnvironmentVariableIntNotParsed
Fields
source: ParseIntError
Returned if an environment variable for a port number cannot be parsed from the environment variable string into a number
EventError
Returned if a registered extension function returns an error
InputItemNotFound
Fields
name: String
Returned if a GraphQL query is missing an expected argument. For example, if a create mutation call were missing its input argument. Also returned if an input argument is missing an expected field.
InvalidHeaderName
Fields
source: InvalidHeaderName
Returned if an invalid header name is passed to the constructor for creating an http client.
InvalidHeaderValue
Fields
source: InvalidHeaderValue
LabelNotFound
Returned if an internal CRUD handler tries to retrieve the label for a node or relationship from an internal temporary bookkeeping structure and is unable to do so. This almost certainly indicates an internal bug. Thus, if you happen to see it, please open an issue at the Warpgrapher project.
PartitionKeyNotFound
Returned if a partition key is None
for a database back-end that requires one, such as
Cosmos DB
PayloadNotFound
Fields
response: Value
Returned if a Client
receives a valid JSON response that does not contain the
expected ‘data’ or ‘errors’ objects.
The serde_json::Value
tuple value contains the deserialized JSON response.
RelDuplicated
Return if a query tries to read and return a relationship defined in the GraphQL schema as
being a single relationship (one-to-one), for which the back-end database has multiple
outgoing relationship edges (one-to-many or many-to-many). The rel_name
field holds the
name of the relationship, and the ids
field holds a list of ids of the relationships
found.
ResolverNotFound
Fields
name: String
Returned if a custom endpoint is defined or a resolver is defined for a field, but the
corresponding resolver is not provided. The name
field contains the name of the resolver
that could not be found.
ResponseSetNotFound
Returned if a database query is missing a set of results altogether, where one is expected. This likely indicates an internal bug. Thus, if you happen to see it, please open an issue at the Warpgrapher project.
ResponseItemNotFound
Fields
name: String
Returned if a database query result is missing an expected property. For example, if a Cosmos DB query were to be missing the value for a property, or if the query fails to to return an expected node or relationship. This could occur if a custom resolver creates a node or rel witout adding mandatory properties, such as an ID.
SerializationFailed
Fields
source: Error
Returned if a GraphQL response or a database query parameter cannot be converted to a serde_json::Value, or if a query
SchemaItemNotFound
Fields
name: String
Returned if Warpgrapher fails to find an element within a schema, such as a type or property. This is very unlikely to be returned as a result of problems with inputs to the engine and most likely indicates an internal bug. Thus, if you happen to see it, please open an issue at the Warpgrapher project. The field is the name of the schema element that could not be fiound.
ThreadCommunicationFailed
Fields
source: RecvError
When the Warpgrapher client sends queries to a local instance of a Warpgrapher engine, it runs the engine in a separate thread, where it can have its own tokio execution context. This error indicates an error in receiving the query answer from the engine thread.
TransactionFinished
Returned if a transaction is used after it is committed or rolled back.
TypeConversionFailed
Warpgrapher transforms data between different serialization formats in the course of
relaying data between GraphQL and database back-ends. If data fails to convert successfully,
this error is thrown. The src
field contains the source type name or value that could not
be converted.
TypeNotExpected
Returned in multiple circumstances if the type information associated with a Value
is
inconsistent with the type required. Examples include:
- a Warpgrapher
Value
enum doesn’t match the variant expected for a given property, such as an ID represented by something other than a string value - a configuration schema is parsed incorrectly, resulting in an unexpected GraphQL endpoint input argument
This error could be returned if a custom resolver creates a node or relationship with a property of a type that doesn’t match the type in the schema, such a creating an integer property where the schema configures Warpgrapher to expect a string. However, other than that case, this error most likely indicates an internal bug for which an issue should be opened at the Warpgrapher project.
UserDefinedError
Returned when encapsulating an error thrown in event handlers provided by users of Warpgrapher
UuidNotParsed
Fields
source: Error
Returned if the String argument for an id cannot be parsed into a UUID
ValidationFailed
Fields
message: String
This error is returned by a custom input validator when the validation fails. The message String describes the reason the field failed validation.
ValidatorNotFound
Fields
name: String
Returned if a custom input validator is defined, but the corresponding validator is not
provided. The name
field contains the name of the validator that wasn’t found.
YamlDeserializationFailed
Fields
source: Error
Returned if a serde_yaml::Value
struct fails to deserialize into a given struct
Trait Implementations
sourceimpl Error for Error
impl Error for Error
sourcefn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
The lower-level source of this error, if any. Read more
sourcefn backtrace(&self) -> Option<&Backtrace>
fn backtrace(&self) -> Option<&Backtrace>
backtrace
)Returns a stack backtrace, if available, of where this error occurred. Read more
1.0.0 · sourcefn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
sourceimpl From<ParseBoolError> for Error
impl From<ParseBoolError> for Error
sourcefn from(e: ParseBoolError) -> Self
fn from(e: ParseBoolError) -> Self
Converts to this type from the input type.
sourceimpl From<ParseIntError> for Error
impl From<ParseIntError> for Error
sourcefn from(e: ParseIntError) -> Self
fn from(e: ParseIntError) -> Self
Converts to this type from the input type.
sourceimpl From<TryFromIntError> for Error
impl From<TryFromIntError> for Error
sourcefn from(_e: TryFromIntError) -> Self
fn from(_e: TryFromIntError) -> Self
Converts to this type from the input type.
Auto Trait Implementations
impl !RefUnwindSafe for Error
impl Send for Error
impl Sync for Error
impl Unpin for Error
impl !UnwindSafe for Error
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more