25 lines
949 B
Rust
25 lines
949 B
Rust
use serde_json::Value;
|
|
use thiserror::Error;
|
|
|
|
#[derive(Debug, Error)]
|
|
pub enum GraphqlAdapterError {
|
|
#[error("invalid graphql endpoint: {url}")]
|
|
InvalidEndpoint { url: String },
|
|
#[error("invalid header name {header}")]
|
|
InvalidHeaderName { header: String },
|
|
#[error("invalid header value for {header}")]
|
|
InvalidHeaderValue { header: String },
|
|
#[error("graphql variables must be a JSON object")]
|
|
InvalidVariablesShape,
|
|
#[error("invalid graphql response path: {path}")]
|
|
InvalidResponsePath { path: String },
|
|
#[error("graphql response path did not match any value: {path}")]
|
|
ResponsePathNotFound { path: String },
|
|
#[error("request failed")]
|
|
Transport(#[from] reqwest::Error),
|
|
#[error("graphql endpoint returned status {status}")]
|
|
UnexpectedStatus { status: u16, body: Value },
|
|
#[error("graphql operation returned errors")]
|
|
OperationErrors { errors: Value, data: Option<Value> },
|
|
}
|