[object Object] is returned from a binding when resolver throws an error
See original GitHub issueI’ve noticed that when a query/mutation is executed via a graphql binding an [Object object] error is returned. This behaviour is observed when an error is thrown in resolver as a part of a business logic.
const resolvers = {
Query: {
test: async (parent, args, context) => {
// some random _id that is passed as a query arg
const _id = '507f1f77bcf86cd799439011';
const binding = await context.bindings.organisations.query.organisation({ _id }, '{ _id }', { context: { foo: 'foo' } });
return 'foo';
}
}
};
organisation
query throws an Apollo error when organisation is not found by id.

Funny enough the cause is an old version of graphql-tools and the PR for it was already made: https://github.com/graphql-binding/graphql-binding/pull/161
When will it be merged?
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:14 (5 by maintainers)
Top Results From Across the Web
How to return both error and data in a graphql resolver? - Help
GraphQL works with both object & field-level resolvers. Partial errors works as long as they're in different fields.
Read more >Can Spring MVC catch an exception and return a ...
So I have two questions about how to do this: 1) Can I manually create the BindingResult object out of a list of...
Read more >A Definitive Guide to Handling Errors in JavaScript - Kinsta
Errors in JavaScript are objects shown whenever a programming error occurs. ... An exception is an error object that has been thrown.
Read more >A mostly complete guide to error handling in JavaScript.
Learn how to deal with errors and exceptions in synchronous and asynchronous JavaScript code.
Read more >DataBinder (Spring Framework 6.0.3 API)
public class DataBinder extends Object implements PropertyEditorRegistry, TypeConverter ... Return the strategy for processing binding errors. BindingResult.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I found a workaround at https://github.com/apollographql/graphql-tools/issues/480#issuecomment-444318754.
For anyone interested:
Anyways:
https://github.com/apollographql/graphql-tools/pull/1206