Skip to content

Commit

Permalink
Ensure we always output the inner error message. (#289)
Browse files Browse the repository at this point in the history
  • Loading branch information
obi1kenobi authored May 17, 2023
1 parent 30d3d64 commit 210704c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions trustfall_core/src/frontend/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ use crate::{ir::FieldValue, util::DisplayVec};
#[non_exhaustive]
#[derive(Debug, Clone, PartialEq, Eq, Deserialize, Serialize, thiserror::Error)]
pub enum FrontendError {
#[error("Multiple errors: {0}")]
#[error("{0}")]
MultipleErrors(DisplayVec<FrontendError>),

#[error("Query failed to parse.")]
#[error("{0}")]
ParseError(#[from] crate::graphql_query::error::ParseError),

#[error("Filter on property name \"{0}\" uses undefined tag: %{1}")]
Expand Down Expand Up @@ -103,7 +103,7 @@ pub enum FrontendError {
#[error("Meta field \"{0}\" is a property but the query uses it as an edge.")]
PropertyMetaFieldUsedAsEdge(String),

#[error("The query failed to validate against the schema.")]
#[error("The query failed to validate against the schema: {0}")]
ValidationError(#[from] ValidationError),

#[error("Unexpected error: {0}")]
Expand Down
10 changes: 5 additions & 5 deletions trustfall_core/src/graphql_query/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ use serde::{ser::Error as SerError, Deserialize, Serialize, Serializer};
#[non_exhaustive]
#[derive(Debug, Clone, PartialEq, Eq, Deserialize, Serialize, thiserror::Error)]
pub enum ParseError {
#[error("Found unrecognized directive {0}")]
#[error("Unrecognized directive {0}")]
UnrecognizedDirective(String, Pos),

#[error("Found directive in unsupported position {0}: {1}")]
#[error("Directive in unsupported position {0}: {1}")]
UnsupportedDirectivePosition(String, String, Pos),

#[error("Directive {0} missing required argument {1}")]
Expand Down Expand Up @@ -54,17 +54,17 @@ pub enum ParseError {
#[error("Unrecognized transform operator: {0}")]
UnsupportedTransformOperator(String, Pos),

#[error("Specified output name \"{0}\" contains invalid characters: {1:?}")]
#[error("Output name \"{0}\" contains invalid characters: {1:?}")]
InvalidOutputName(String, Vec<char>, Pos),

#[error("Specified tag name \"{0}\" contains invalid characters: {1:?}")]
#[error("Tag name \"{0}\" contains invalid characters: {1:?}")]
InvalidTagName(String, Vec<char>, Pos),

#[serde(
skip_deserializing,
serialize_with = "fail_serialize_invalid_graphql_error"
)]
#[error("Input is not valid GraphQL: {0}")]
#[error("{0}")]
InvalidGraphQL(async_graphql_parser::Error),

#[error("Unsupported syntax feature found: {0}")]
Expand Down

0 comments on commit 210704c

Please sign in to comment.