From 21cec744c0527d37fec9dc5afca7e663012c67ff Mon Sep 17 00:00:00 2001 From: Graeme Coupar Date: Sat, 6 Apr 2024 17:28:23 +0100 Subject: [PATCH] fix: better type kind mismatch errors (#889) A user ran into this particular error message and it wasn't clear to them what their mistake was. This change hopefully makes things clearer. --- cynic-codegen/src/schema/mod.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cynic-codegen/src/schema/mod.rs b/cynic-codegen/src/schema/mod.rs index 32682ce1..32cd178a 100644 --- a/cynic-codegen/src/schema/mod.rs +++ b/cynic-codegen/src/schema/mod.rs @@ -128,8 +128,8 @@ impl std::fmt::Display for SchemaError { found, } => write!( f, - "Expected type `{}` to be a {} but it was a {}", - name, expected, found + "The type `{}` is a {} in the GraphQL schema but is being used where we expect a {}", + name, found, expected, ), Self::InvalidTypeInSchema { name, details } => { write!(f, "Invalid schema when validating `{}`: {}", name, details)