Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom error response #359

Closed
featherbits opened this issue Nov 25, 2018 · 3 comments
Closed

Custom error response #359

featherbits opened this issue Nov 25, 2018 · 3 comments
Assignees
Milestone

Comments

@featherbits
Copy link

featherbits commented Nov 25, 2018

I would like to add custom JSON properties to error response besides message, path, locations. I found that I can use IResolverContext.ReportError(string errorMessage) method to add error message. Cannot find how to add extra properties. Is there a way to report error via IQueryError from resolver or #317 is the way to go?

It seems that QueryError class has everything what is needed in terms of representing error. But how to assign it to response without throwing exception?

This works

throw new QueryException(new QueryError("Email and password credentials not recognised", new ErrorProperty("code", "INVALID_IDENTITY_CREDENTIALS")));

However it would be nice to add only extensions and message as part of error response for current resolver without throwing exception.

@michaelstaib
Copy link
Member

I will add an overload to the resolver context that allows IQueryError as an argument. Should be included in a fix that I will release Sunday night.

@michaelstaib michaelstaib added this to the 0.6.7 milestone Nov 25, 2018
@michaelstaib
Copy link
Member

I will move this one to the next feature version since I have to move the query type to the type system. We had some feature request in the error area that will be implemented with version 0.7.0 so it is a good fit for this version.

We are currently planing to release 0.7.0 ad the end of December.

@michaelstaib
Copy link
Member

This one is now implemented with #374 and will be included in 0.7.0-preview.4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants