webcompat / webcompat-metrics-server

Server in charge of delivering different data to the webcompat-metrics-client

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

magsout opened this issue · comments

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.

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

@miketaylr

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

metrics server api

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

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... 😜

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).