Skip to content

Commit b1173b0

Browse files
committed
Improve error message when query name is missing
I'm not used to working with GraphQL, so the current short error message confused me. I did not understand what kind of name was missing. Make the error message more helpful by hinting what the likely (only?) problem is.
1 parent c52e89e commit b1173b0

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

graphql_client_codegen/src/query.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ where
154154
) => {
155155
let on = schema.query_type();
156156
let resolved_operation: ResolvedOperation = ResolvedOperation {
157-
name: q.name.as_ref().expect("query without name").as_ref().into(),
157+
name: q.name.as_ref().expect("query without name. Instead of `query (...)`, write `query SomeName(...)` in your .graphql file").as_ref().into(),
158158
_operation_type: operations::OperationType::Query,
159159
object_id: on,
160160
selection_set: Vec::with_capacity(q.selection_set.items.len()),

0 commit comments

Comments
 (0)