webcompat / webcompat-metrics-server

Server in charge of delivering different data to the webcompat-metrics-client
Mozilla Public License 2.0
6 stars 5 forks source link

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

Open magsout opened 4 years ago

magsout commented 4 years ago

Due to https://github.com/webcompat/webcompat.com/issues/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 commented 4 years ago

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

magsout commented 4 years ago

@miketaylr

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

metrics server api

laghee commented 4 years ago

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

laghee commented 4 years ago

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 commented 4 years ago

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