Errors¶
- class kinto.core.errors.ERRORS(value)¶
Predefined errors as specified by the API.
Status code
Errno
Description
401
104
Missing Authorization Token
401
105
Invalid Authorization Token
400
106
request body was not valid JSON
400
107
invalid request parameter
400
108
missing request parameter
400
109
invalid posted data
404
110
Invalid Token / id
404
111
Missing Token / id
411
112
Content-Length header was not provided
413
113
Request body too large
412
114
Resource was modified meanwhile
405
115
Method not allowed on this end point
404
116
Requested version not available on this server
429
117
Client has sent too many requests
403
121
Resource’s access forbidden for this user
409
122
Another resource violates constraint
500
999
Internal Server Error
503
201
Service Temporary unavailable due to high load
410
202
Service deprecated
- class kinto.core.errors.ErrorSchema(*args, **kw)¶
Payload schema for Kinto errors.
- kinto.core.errors.http_error(httpexception, errno=None, code=None, error=None, message=None, info=None, details=None)¶
Return a JSON formated response matching the error HTTP API.
- Parameters
httpexception – Instance of
httpexceptions
errno – stable application-level error number (e.g. 109)
code – matches the HTTP status code (e.g 400)
error – string description of error type (e.g. “Bad request”)
message – context information (e.g. “Invalid request parameters”)
info – information about error (e.g. URL to troubleshooting)
details – additional structured details (conflicting object)
- Returns
the formatted response object
- Return type
- kinto.core.errors.json_error_handler(request)¶
Cornice JSON error handler, returning consistant JSON formatted errors from schema validation errors.
This is meant to be used is custom services in your applications.
upload = Service(name="upload", path='/upload', error_handler=errors.json_error_handler)
Warning
Only the first error of the list is formatted in the response. (c.f. HTTP API).
- kinto.core.errors.raise_invalid(request, location='body', name=None, description=None, **kwargs)¶
Helper to raise a validation error.
- Parameters
location – location in request (e.g.
'querystring'
)name – field name
description – detailed description of validation error
- Raises
- kinto.core.errors.send_alert(request, message=None, url=None, code='soft-eol')¶
Helper to add an Alert header to the response.
- Parameters
code – The type of error ‘soft-eol’, ‘hard-eol’
message – The description message.
url – The URL for more information, default to the documentation url.
- kinto.core.errors.request_GET(request)¶
Catches a UnicodeDecode error in request.GET in case a wrong request was received. Fixing a webob long term issue: https://github.com/Pylons/webob/issues/161