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

Fix Web Page Error Handling #91

Open
3 tasks
joeyjoejoejr opened this issue May 5, 2020 · 0 comments
Open
3 tasks

Fix Web Page Error Handling #91

joeyjoejoejr opened this issue May 5, 2020 · 0 comments
Labels
bug Something isn't working

Comments

@joeyjoejoejr
Copy link
Collaborator

Currently errors that happen when rendering an html page (rather than a json response) are handled very poorly. No content is returned, or text error content is returned.

  • Add 404 page
  • Add 500 page
  • Handle 403 errors from API responses by clearing the token and redirecting to the homepage with a flash message prompting users to log back in.

All of this will need to be done using: https://docs.rs/actix-web/2.0.0/actix_web/middleware/errhandlers/struct.ErrorHandlers.html

We will also need to separate out the API error responses from the web html responses. I can think of a couple ways to do that.

a. Add a check to those error_handling routes for the Content-Type of the response and if it's text/html render the proper page or if it's application/json render the error properly. This will also play into the app's error handling in the error module, which implements the ResponseError trait.
b. Always return a 200 for api calls, but have an optional error field that any caller would have to check. This could work ok because all the api endpoints are used by webhooks which don't really care what the response is, and will work well with the standard way that GraphQL handles errors.

@joeyjoejoejr joeyjoejoejr added the bug Something isn't working label May 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant