core.errors

Module Contents

exception core.errors.HTTPException(status, name, descr)

Bases: Exception

Base-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

process()
exception core.errors.BadRequest(descr='The request your browser sent cannot be fulfilled due to bad syntax.')

Bases: HTTPException

BadRequest

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: HTTPException

Causes 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) –

exception core.errors.Unauthorized(descr="The resource is protected and you don't have the permissions.")

Bases: HTTPException

Unauthorized

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: HTTPException

PaymentRequired

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: HTTPException

Forbidden

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: HTTPException

NotFound

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: HTTPException

MethodNotAllowed

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: HTTPException

NotAcceptable

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: HTTPException

RequestTimeout

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: HTTPException

Gone

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: HTTPException

PreconditionFailed

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: HTTPException

RequestTooLarge

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: HTTPException

Locked

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: HTTPException

Too 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: HTTPException

Unprocessable 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: HTTPException

Censored

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: HTTPException

InternalServerError

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: HTTPException

NotImplemented

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: HTTPException

BadGateway

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.ServiceUnavailable(descr='Service Unavailable')

Bases: HTTPException

ServiceUnavailable

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