Skip to content

Commit

Permalink
Improve error message clarity
Browse files Browse the repository at this point in the history
Reviewed By: alunyov

Differential Revision: D50328190

fbshipit-source-id: 1d9f26cc429a6951fbe09783e1745a356decdc35
  • Loading branch information
captbaritone authored and facebook-github-bot committed Oct 16, 2023
1 parent 4ffd869 commit 9a96c6a
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
6 changes: 4 additions & 2 deletions compiler/crates/graphql-ir/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -220,15 +220,17 @@ pub enum ValidationMessage {
},

#[error(
"Expected field '{connection_field_name}' to have a '{first_arg}' or '{last_arg}' argument."
"Expected field '{connection_field_name}' to be passed a '{first_arg}' or '{last_arg}' argument."
)]
ExpectedConnectionToHaveCountArgs {
connection_field_name: StringKey,
first_arg: ArgumentName,
last_arg: ArgumentName,
},

#[error("Expected '{connection_field_name}' to have a '{edges_selection_name}' selection.")]
#[error(
"Expected '{connection_field_name}' to be passed a '{edges_selection_name}' selection."
)]
ExpectedConnectionToHaveEdgesSelection {
connection_field_name: StringKey,
edges_selection_name: StringKey,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ query NodeQuery($id: ID!, $first: Int, $after: ID) {
}
}
==================================== ERROR ====================================
✖︎ Expected 'comments' to have a 'edges' selection.
✖︎ Expected 'comments' to be passed a 'edges' selection.

connection-missing-edges-selection.invalid.graphql:6:7
5 │ ... on Story {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ query NodeQuery($id: ID!) {
}
}
==================================== ERROR ====================================
✖︎ Expected field 'comments' to have a 'first' or 'last' argument.
✖︎ Expected field 'comments' to be passed a 'first' or 'last' argument.

connection-missing-first-arg.invalid.graphql:6:7
5 │ ... on Story {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ type BadConnectionPageInfo {
startCursor: String
}
==================================== ERROR ====================================
✖︎ Expected 'badConnection' to have a 'edges' selection.
✖︎ Expected 'badConnection' to be passed a 'edges' selection.

connection-invalid-edges-list-type.invalid.graphql:6:7
5 │ ... on User {
Expand Down

0 comments on commit 9a96c6a

Please sign in to comment.