Error Handling #
All errors received by Kuzzle clients are
KuzzleError error objects.
KuzzleError object has the following properties:
|Error unique code
|Error full name
|Short description of the error
|(Available in development mode only) Error stack trace
|HTTP status code
Clients can detect the error type based on the
status and process the error accordingly.
code property is a concatenation of 3 codes:
- The domain code (eg.
- The subdomain code (eg.
- The proper error code (eg.
02 as domain code on 1 byte,
04 as subdomain code on 1 byte and
0001 as error code on 2 bytes.
The full list of Kuzzle API errors is available here.
id property is a concatenation of 3 levels of precisions, indicating the origin of the error: the domain, the subdomain, and the error name.
For instance, the error
api.auth.database_not_found was raised in the API, by the Auth controller.
You can see the full definition about Kuzzle errors here
Common errors #
All Kuzzle requests can return one of the following errors:
BadRequestError error is thrown if Kuzzle was unable to process the action due to a malformed request, or if required parameters are missing.
ExternalServiceError error is thrown if Kuzzle was unable to process the action due to an external service failure (e.g. database down).
ForbiddenError error is thrown if the current authenticated user is not authorized to perform the requested action.
GatewayTimeoutError error is thrown if Kuzzle, or a plugin, takes too long to respond.
Receiving this error does not guarantee the original request was not processed, just that it was not processed in time.
The Client Application will have to determine if the process was completed.
InternalError error is thrown if Kuzzle encountered an unexpected error.
PluginImplementationError error is a generic error thrown by Kuzzle on a plugin failure.
ServiceUnavailableError error can be sent by Kuzzle if it overloaded and cannot temporarily accept new requests, or if the requested Kuzzle instance is shutting down.
Specific errors #
These errors are specific to controller actions. Check controllers documentation.
NotFoundError error is thrown if the requested resource could not be found (e.g. a document is requested with a non-existing id).
PartialError error is thrown if Kuzzle was unable to process a subset of a multi-action request.
PartialError can be triggered, for instance, if one or several queries inside a
document:mCreate request failed.
The detail of each failure can be retrieved in the
errors property of the error object.
Additional Properties #
|Number of failures encountered
|array of objects
PreconditionError error is thrown if Kuzzle was not able to process the request due to an invalid state.
For instance, this error can be generated when trying to create a document on a non-existing index.
SizeLimitError error is thrown by Kuzzle if the request size exceeds the limits defined in the configuration.
UnauthorizedError error is thrown by Kuzzle when an authentication attempt failed, or if a requested resource needs an authentication to be accessed.