I was trying to return a type/object with error, so that I can debug my error from front-end, but it seems when I return any value into error then the whole object always return as null :( but if I return error as nil then it return object's value.

Same problem by me
In fact, this is a tricky problem that is difficult to solve according to the current code implementation.
this is part of the GraphQL spec:
https://facebook.github.io/graphql/June2018/#sec-Data
If an error was encountered during the execution that prevented a valid response, the data entry in the response should be null.
@svanburen agree on resolving 1 instance, but this also occurs on returning a list and there I'm not sure if it should...
When you have a list of 10 items and 9 resolve correctly, and the tenth throws an error. Should you still be forced to give a null back while the 9 sub resolvers did produce a valid response?
@VincentVW https://graphql.github.io/graphql-spec/June2018/#example-90475 - I'd agree that you shouldn't be forced to give null back in that situation.
Most helpful comment
this is part of the GraphQL spec:
https://facebook.github.io/graphql/June2018/#sec-Data