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

Return errors as JSON #33

Closed
ghost opened this issue May 17, 2019 · 6 comments
Closed

Return errors as JSON #33

ghost opened this issue May 17, 2019 · 6 comments
Labels
enhancement New feature or request released This issue or pull request is released

Comments

@ghost
Copy link

ghost commented May 17, 2019

How can I setup Sofa so that when my queries throws error they are formatted as JSON instead of HTML?

@Urigo
Copy link
Owner

Urigo commented May 31, 2019

Can you create a small repo that does that, maybe with a test?
I can work on that then

@ghost
Copy link
Author

ghost commented Jun 3, 2019

Here you can find the code: https://typegraphql.ml/docs/authorization.html#recipes
The problem is that if JWT throws any error, SOFA would spit out an HTML file instead of a JSON.

@antitoine
Copy link

Same problem for me. I was wondering if it would not be possible to rewrite the execution function ('execute' option when creating sofa router, adding a simple try/catch), but we have no way to call back the initial sofa execution function.

@ardatan ardatan added enhancement New feature or request waiting-for-release This issue or pull request is waiting to be released labels Jul 10, 2019
@kamilkisiela
Copy link
Collaborator

Related #44 #45

@kamilkisiela
Copy link
Collaborator

Released as v0.4.0

@kamilkisiela kamilkisiela added released This issue or pull request is released and removed waiting-for-release This issue or pull request is waiting to be released labels Jul 18, 2019
@kamilkisiela
Copy link
Collaborator

Closing but let us know if there's still an issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request released This issue or pull request is released
Projects
None yet
Development

No branches or pull requests

4 participants