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

Convert eventual html GitHub (etc) errors into json for client #133

Open
magsout opened this issue Jan 3, 2020 · 5 comments
Open

Convert eventual html GitHub (etc) errors into json for client #133

magsout opened this issue Jan 3, 2020 · 5 comments

Comments

@magsout
Copy link
Member

magsout commented Jan 3, 2020

Due to webcompat/webcompat.com#3118 we get an error on https://webcompat-dashboard.herokuapp.com/triage?direction=desc&sort=created&view=card

But, is it possible for the API to send the error as a JSON response, not html? Not for this endpoint in particular but for all. I can't hand handle HTML response but on only json reponse, that's why I display a generic message.

@miketaylr
Copy link
Member

Do you mean the GitHub API? Or the metrics server API?

@magsout
Copy link
Member Author

magsout commented Jan 7, 2020

@miketaylr

Do you mean the GitHub API? Or the metrics server API?

metrics server api

@laghee
Copy link
Collaborator

laghee commented Jan 7, 2020

@magsout I think we can do that. Let me check and get back to you...

@laghee
Copy link
Collaborator

laghee commented Jan 7, 2020

So we're actually set up to send only json responses. This makes me think that on certain kinds of failure, we must just do a direct transfer of the original github response.

Do you happen to have a screenshot or console logs for how this looked when the whole repo was down, @magsout? Now that the calls are working again, I'm not totally sure how to mock a failure to figure out what to catch in the future... 😜

@laghee
Copy link
Collaborator

laghee commented Jan 7, 2020

If not, it's probably worth setting up a general error handling module like we have in webcompat.com (https://github.com/webcompat/webcompat.com/blob/master/webcompat/error_handlers/__init__.py).

@laghee laghee changed the title error response json Convert eventual html GitHub errors into json for client Jan 7, 2020
@laghee laghee changed the title Convert eventual html GitHub errors into json for client Convert eventual html GitHub (etc) errors into json for client Jan 7, 2020
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

3 participants