core.errors¶
Exceptions¶
Base-Class for all Exceptions that should match to an http error-code |
|
BadRequest |
|
Causes an 303 - See Other (or 302 - Found if requested / 301 - Moved Permanently) redirect |
|
Unauthorized |
|
PaymentRequired |
|
Forbidden |
|
NotFound |
|
MethodNotAllowed |
|
NotAcceptable |
|
RequestTimeout |
|
Gone |
|
PreconditionFailed |
|
RequestTooLarge |
|
Locked |
|
Too Many Requests |
|
Unprocessable Entity |
|
Censored |
|
InternalServerError |
|
NotImplemented |
|
BadGateway |
|
ServiceUnavailable |
Module Contents¶
- exception core.errors.HTTPException(status, name, descr)¶
Bases:
ExceptionBase-Class for all Exceptions that should match to an http error-code
- Parameters:
status (int) – The desired http error-code (404, 500, …)
name (str) – Name as of RFC 2616
descr (str) – Human-readable description of that error
- status¶
- name¶
- descr = ''¶
- process()¶
- exception core.errors.BadRequest(descr='The request your browser sent cannot be fulfilled due to bad syntax.')¶
Bases:
HTTPExceptionBadRequest
- Parameters:
status – The desired http error-code (404, 500, …)
name – Name as of RFC 2616
descr (str) – Human-readable description of that error
- exception core.errors.Redirect(url, descr='Redirect', status=303)¶
Bases:
HTTPExceptionCauses an 303 - See Other (or 302 - Found if requested / 301 - Moved Permanently) redirect
- Parameters:
status (int) – The desired http error-code (404, 500, …)
name – Name as of RFC 2616
descr (str) – Human-readable description of that error
url (str)
- url¶
- exception core.errors.Unauthorized(descr="The resource is protected and you don't have the permissions.")¶
Bases:
HTTPExceptionUnauthorized
Raised whenever a request hits an path protected by canAccess() or a canAdd/canEdit/… -Function inside an application returns false.
- Parameters:
status – The desired http error-code (404, 500, …)
name – Name as of RFC 2616
descr (str) – Human-readable description of that error
- exception core.errors.PaymentRequired(descr='Payment Required')¶
Bases:
HTTPExceptionPaymentRequired
Not used inside viur.core. This status-code is reserved for further use and is currently not supported by clients.
- Parameters:
status – The desired http error-code (404, 500, …)
name – Name as of RFC 2616
descr (str) – Human-readable description of that error
- exception core.errors.Forbidden(descr="The resource is protected and you don't have the permissions.")¶
Bases:
HTTPExceptionForbidden
Not used inside viur.core. May be utilized in the future to distinguish between requests from guests and users, who are logged in but don’t have the permission.
- Parameters:
status – The desired http error-code (404, 500, …)
name – Name as of RFC 2616
descr (str) – Human-readable description of that error
- exception core.errors.NotFound(descr='The requested resource could not be found.')¶
Bases:
HTTPExceptionNotFound
Usually raised in view() methods from application if the given key is invalid.
- Parameters:
status – The desired http error-code (404, 500, …)
name – Name as of RFC 2616
descr (str) – Human-readable description of that error
- exception core.errors.MethodNotAllowed(descr='Method Not Allowed')¶
Bases:
HTTPExceptionMethodNotAllowed
Raised if a function is accessed which doesn’t have the @exposed / @internalExposed decorator or if the request arrived using get, but the function has the @forcePost flag.
- Parameters:
status – The desired http error-code (404, 500, …)
name – Name as of RFC 2616
descr (str) – Human-readable description of that error
- exception core.errors.NotAcceptable(descr='The request cannot be processed due to missing or invalid parameters.')¶
Bases:
HTTPExceptionNotAcceptable
Signals that the parameters supplied doesn’t match the function signature
- Parameters:
status – The desired http error-code (404, 500, …)
name – Name as of RFC 2616
descr (str) – Human-readable description of that error
- exception core.errors.RequestTimeout(descr='The request has timed out.')¶
Bases:
HTTPExceptionRequestTimeout
This must be used for the task api to indicate it should retry
- Parameters:
status – The desired http error-code (404, 500, …)
name – Name as of RFC 2616
descr (str) – Human-readable description of that error
- exception core.errors.Gone(descr='Gone')¶
Bases:
HTTPExceptionGone
The 410 (Gone) status code indicates that access to the target resource is no longer available at the origin server and that this condition is likely to be permanent. If the origin server does not know, or has no facility to determine, whether or not the condition is permanent, the status code 404 (Not Found) ought to be used instead.
See https://datatracker.ietf.org/doc/html/rfc7231#section-6.5.9
- Parameters:
status – The desired http error-code (404, 500, …)
name – Name as of RFC 2616
descr (str) – Human-readable description of that error
- exception core.errors.PreconditionFailed(descr='Precondition Failed')¶
Bases:
HTTPExceptionPreconditionFailed
Mostly caused by a missing/invalid securitykey.
- Parameters:
status – The desired http error-code (404, 500, …)
name – Name as of RFC 2616
descr (str) – Human-readable description of that error
- exception core.errors.RequestTooLarge(descr='Request Too Large')¶
Bases:
HTTPExceptionRequestTooLarge
Not used inside viur.core
- Parameters:
status – The desired http error-code (404, 500, …)
name – Name as of RFC 2616
descr (str) – Human-readable description of that error
- exception core.errors.Locked(descr='Ressource is Locked')¶
Bases:
HTTPExceptionLocked
Raised if a resource cannot be deleted due to incomming relational locks
- Parameters:
status – The desired http error-code (404, 500, …)
name – Name as of RFC 2616
descr (str) – Human-readable description of that error
- exception core.errors.TooManyRequests(descr='Too Many Requests')¶
Bases:
HTTPExceptionToo Many Requests
The 429 status code indicates that the user has sent too many requests in a given amount of time (“rate limiting”).
- Parameters:
status – The desired http error-code (404, 500, …)
name – Name as of RFC 2616
descr (str) – Human-readable description of that error
- exception core.errors.UnprocessableEntity(descr='Unprocessable Entity')¶
Bases:
HTTPExceptionUnprocessable Entity
The 422 (Unprocessable Entity) status code means the server understands the content type of the request entity (hence a 415 (Unsupported Media Type) status code is inappropriate), and the syntax of the request entity is correct (thus a 400 (Bad Request) status code is inappropriate) but was unable to process the contained instructions. For example, this error condition may occur if an XML request body contains well-formed (i.e., syntactically correct), but semantically erroneous, XML instructions
See https://www.rfc-editor.org/rfc/rfc4918#section-11.2
- Parameters:
status – The desired http error-code (404, 500, …)
name – Name as of RFC 2616
descr (str) – Human-readable description of that error
- exception core.errors.Censored(descr='Unavailable For Legal Reasons')¶
Bases:
HTTPExceptionCensored
Not used inside viur.core
- Parameters:
status – The desired http error-code (404, 500, …)
name – Name as of RFC 2616
descr (str) – Human-readable description of that error
- exception core.errors.InternalServerError(descr='Internal Server Error')¶
Bases:
HTTPExceptionInternalServerError
The catch-all error raised by the server if your code raises any python-exception not deriving from HTTPException
- Parameters:
status – The desired http error-code (404, 500, …)
name – Name as of RFC 2616
descr (str) – Human-readable description of that error
- exception core.errors.NotImplemented(descr='Not Implemented')¶
Bases:
HTTPExceptionNotImplemented
Not really implemented at the moment :)
- Parameters:
status – The desired http error-code (404, 500, …)
name – Name as of RFC 2616
descr (str) – Human-readable description of that error
- exception core.errors.BadGateway(descr='Bad Gateway')¶
Bases:
HTTPExceptionBadGateway
Not used inside viur.core
- Parameters:
status – The desired http error-code (404, 500, …)
name – Name as of RFC 2616
descr (str) – Human-readable description of that error
Bases:
HTTPExceptionServiceUnavailable
Not used inside viur.core
- Parameters:
status – The desired http error-code (404, 500, …)
name – Name as of RFC 2616
descr (str) – Human-readable description of that error