[][src]Enum warpgrapher::Error

pub enum Error {
    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,
    },
    ExtensionFailed {
        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,
    UuidNotParsed {
        source: Error,
    },
    ValidationFailed {
        message: String,
    },
    ValidatorNotFound {
        name: String,
    },
    YamlDeserializationFailed {
        source: Error,
    },
}

Error type for Warpgrapher

Examples

use serde_json::json;
use warpgrapher::Error;

let e = Error::PayloadNotFound { response: json!{"surprise"} };

Variants

ClientRequestFailed

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.

Fields of ClientRequestFailed

source: Error
ConfigItemDuplicated

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.

Fields of ConfigItemDuplicated

type_name: String
ConfigItemReserved

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.

Fields of ConfigItemReserved

type_name: String
ConfigOpenFailed

Returned if a Config file cannot be opened, typically because the configuration file cannot be found on disk

Fields of ConfigOpenFailed

source: Error
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.

Fields of ConfigVersionMismatched

expected: i32found: i32
DatabaseNotFound

Returned if the engine is configured to operate without a database. Typically this would never be done in production

JsonDeserializationFailed

Returned if a serde_json::Value struct fails to deserialize into a struct

Fields of JsonDeserializationFailed

source: Error
EnvironmentVariableNotFound

Returned if an environment variable cannot be found. The name field contains the name of the environment variable that could not be found.

Fields of EnvironmentVariableNotFound

name: String
EnvironmentVariableBoolNotParsed

Returned if an environemtn variable for a boolean flag cannot be parsed from the environment variable string into a bool

Fields of EnvironmentVariableBoolNotParsed

source: ParseBoolError
EnvironmentVariableIntNotParsed

Returned if an environment variable for a port number cannot be parsed from the environment variable string into a number

Fields of EnvironmentVariableIntNotParsed

source: ParseIntError
ExtensionFailed

Returned if a registered extension function returns an error

Fields of ExtensionFailed

source: Box<dyn Error + Sync + Send>
InputItemNotFound

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.

Fields of InputItemNotFound

name: String
InvalidHeaderName

Returned if an invalid header is passed to the constructor for creating an http client. There are two possible invalid header types based on whether the name or value was invalid.

Fields of InvalidHeaderName

source: InvalidHeaderName
InvalidHeaderValue

Fields of InvalidHeaderValue

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

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.

Fields of PayloadNotFound

response: Value
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.

Fields of RelDuplicated

rel_name: Stringids: String
ResolverNotFound

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.

Fields of ResolverNotFound

name: String
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

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.

Fields of ResponseItemNotFound

name: String
SerializationFailed

Returned if a GraphQL response or a database query parameter cannot be converted to a serde_json::Value, or if a query

Fields of SerializationFailed

source: Error
SchemaItemNotFound

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.

Fields of SchemaItemNotFound

name: String
ThreadCommunicationFailed

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.

Fields of ThreadCommunicationFailed

source: RecvError
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.

Fields of TypeConversionFailed

src: Stringdst: String
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.

UuidNotParsed

Returned if the String argument for an id cannot be parsed into a UUID

Fields of UuidNotParsed

source: Error
ValidationFailed

This error is returned by a custom input validator when the validation fails. The message String describes the reason the field failed validation.

Fields of ValidationFailed

message: String
ValidatorNotFound

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.

Fields of ValidatorNotFound

name: String
YamlDeserializationFailed

Returned if a serde_yaml::Value struct fails to deserialize into a given struct

Fields of YamlDeserializationFailed

source: Error

Trait Implementations

impl Debug for Error[src]

impl Display for Error[src]

impl Error for Error[src]

impl From<Box<dyn Error + 'static + Sync + Send>> for Error[src]

impl From<Error> for Error[src]

impl From<Error> for Error[src]

impl From<Error> for Error[src]

impl From<Error> for Error[src]

impl From<Error> for Error[src]

impl From<ParseBoolError> for Error[src]

impl From<ParseIntError> for Error[src]

impl From<RecvError> for Error[src]

impl From<TryFromIntError> for Error[src]

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

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,