pub enum Error {
Show 31 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, 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

Fields

expected: i32
found: i32

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

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

Fields

source: Box<dyn Error + Sync + Send>

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

Returned if an invalid header name is passed to the constructor for creating an http client.

InvalidHeaderValue

Fields

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.

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

Fields

rel_name: String
ids: String

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

Fields

src: String
dst: String

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

Fields

details: Option<String>

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

Fields

source: Box<dyn Error + Sync + Send>

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

Formats the value using the given formatter. Read more

Formats the value using the given formatter. Read more

The lower-level source of this error, if any. Read more

🔬 This is a nightly-only experimental API. (backtrace)

Returns a stack backtrace, if available, of where this error occurred. Read more

👎 Deprecated since 1.42.0:

use the Display impl or to_string()

👎 Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more