The GraphQL specification requires certain assumptions to hold true when executing a query. However, it’s possible that some code would violate that assumption, resulting in a type error.
Here are two type errors that you can customize in GraphQL-Ruby:
You can specify behavior in these cases by defining a
class MySchema < GraphQL::Schema def self.type_error(err, query_ctx) # Handle a failed runtime type coercion end end
If you don’t specify a hook, you get the default behavior:
nils add an error the response’s
An object that fails type resolution is treated as