Errors tracking #
The Kuzzle IoT platform has an internal error tracking system.
Thus, the errors are systematically saved with their context in a collection in order to allow a future investigation or statistics.
Automatic error saving #
Errors are automatically saved except for those with the following statuses: 404
, 401
, 403
and 412
.
All other errors are saved automatically with the following information:
error
: error object containingid
: unique identifier of the errorname
: error namestatus
: HTTP status codemessage
: error messagestack
: complete stacktrace
context
: object containing the context of the request, with in particular:user
: authenticated user_id
: user IDprofileIds
: identifying profiles
input
: object containing the input data, including:controller
: controller nameaction
: action name
It is then possible to consult this error list from the Admin Console.
Saving an error from the framework #
During a backend processing, it is possible to wish to save an error in the dedicated collection.
To do this, it is possible to use the iot-platform:error:save
event with the error
object and an arbitrary context
as a parameter.
Example:
try {
// some action that may fail
} catch (error) {
this.app.trigger<EventIoTPlatformErrorSave>('iot-platform:error:save', {
error,
context: {
foo: 'bar',
},
});
}
Edit this page on Github(opens new window)