Skip to content

Intercepted errors should be returned as HTTP errors to the client #6

@simonw

Description

@simonw

This code here:

except Exception as e:
# Handle any errors during the request
if log:
log.error(f"An error occurred: {e.__class__.__name__}: {e}")
return

It should actually return a 500 error with a simple HTML page saying roughly what went wrong.

There are actually a few relevant HTTP errors here:

  • 502 Bad Gateway - if it gets a "bad response" of some sort from the backend (not sure what the definition of "bad" there should be).
  • 504 Gateway Timeout - if the backend times out. Having a timeout setting would be useful generally.
  • 503 Service Unavailable - backend server is unavailable.

I'm not sure how to decide between a 502 and a 503.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions