gws.base.web.error

HTTP exceptions and conversion of GWS errors to HTTP errors.

Source code: gws.base.web.error

Module Contents

gws.base.web.error.BadGateway
gws.base.web.error.BadRequest
gws.base.web.error.Conflict
gws.base.web.error.ExpectationFailed
gws.base.web.error.Forbidden
gws.base.web.error.from_exception(exc: Exception) → HTTPException

Convert an exception to an HTTP exception.

HTTP exceptions are returned as is. gws.NotFoundError, gws.ForbiddenError, gws.BadRequestError, gws.TooManyRequestsError and gws.ResponseTooLargeError are converted to 404, 403, 400, 429 and 409 and logged as warnings. Other exceptions are logged with the traceback and converted to 500. The original exception is set as the cause of the new one.

Parameters:

exc – An exception.

Returns:

An HTTP exception.

gws.base.web.error.GatewayTimeout
gws.base.web.error.Gone
gws.base.web.error.HTTPException
gws.base.web.error.HTTPVersionNotSupported
gws.base.web.error.ImATeapot
gws.base.web.error.InternalServerError
gws.base.web.error.LengthRequired
gws.base.web.error.Locked
gws.base.web.error.MethodNotAllowed
gws.base.web.error.NotAcceptable
gws.base.web.error.NotFound
gws.base.web.error.NotImplemented
gws.base.web.error.PreconditionFailed
gws.base.web.error.PreconditionRequired
gws.base.web.error.RequestedRangeNotSatisfiable
gws.base.web.error.RequestEntityTooLarge
gws.base.web.error.RequestHeaderFieldsTooLarge
gws.base.web.error.RequestTimeout
gws.base.web.error.RequestURITooLarge
gws.base.web.error.ServiceUnavailable
gws.base.web.error.TooManyRequests
gws.base.web.error.Unauthorized
gws.base.web.error.UnavailableForLegalReasons
gws.base.web.error.UnprocessableEntity
gws.base.web.error.UnsupportedMediaType