Errors
Error tracking is a critical aspect of maintaining a stable and reliable application. By monitoring errors and exceptions, you can identify and address issues before they impact users.
The errors instrument in the Exot Inspector enables efficient tracking of errors and exceptions within your application, providing valuable insights to identify the root cause of these issues.
Instrument
Access the errors instrument via the errors
namespace:
Configuration
Configure the errors instrument using the main Inspector configuration options:
Available configuration options:
disabled: boolean
: Disables the instrument. When disabled, the instrument cannot be activated, and no data will be recorded (defaultfalse
).
Tracking Errors
To track an error, utilize the push
method of the errors
instrument. The message
of the error is mandatory, while remaining properties are optional.
The labeling, such as “server” for server-side errors or “app” for front-end errors, should be appropriate to the context.
Alternatively, you can provide an instance of an Error
:
Module Detection
The error tracking instrument automatically detects npm
modules from the stack trace (if an instance of an Error
is provided) and sets the modules
property.
For example, if an error originates from the stripe
npm package, the modules
property will contain ["stripe"]
.
Querying Errors
While you can easily view tracked errors in the Application, sometimes you may need to perform more specific queries. In such cases, utilize the query()
function, which is consistent across all instruments.