Atatus usually captures all unhandled exceptions automatically. However, if you want to handle your own exceptions, you use the atatus.notify()
function.
Syntax
atatus.notify(error, customData, tags)
Parameter
Parameter | Type | Description |
---|---|---|
error | Error Object (Required) | Error object. |
customData | Set additional meta-data (object) to send along with an error. It helps you to fix the error. Custom data cannot be searchable. (Optional) | object |
tags | Tags are used to search a specific error. Tags may contain release stage, plan, etc. Tags must be an array of strings. (Optional) | array |
Example
You can use the atatus.notify()
within the try - catch block to handle the exceptions.
copy
try {
// code that could throw an exception
throw new Error('Something went wrong!');
} catch(e) {
atatus.notify(e);
}
copy
let error = new Error('Subscription update has failed!');
atatus.notify(error, { user: user }, ['pro-user']);