Tracking errors
Everything is an event in Eventvisor, including errors. This guide will show you how you can define platform-specific errors as events and then track them using Eventvisor SDKs.
Defining error event#
Before tracking anything, we need to define the event that will be tracked later from your application(s):
events/js_error.yml
description: JavaScript error eventtags: - weblevel: errorproperties: name: type: string message: type: string stack: type: string errors: type: array items: type: object properties: name: type: string message: type: stringrequired: - message
Above, we are defining a JavaScript error event called js_error
.
You are recommended to use a prefix depending on the language of your application, because different languages and runtimes have different shapes of errors.
Tracking errors#
Now from your application using JavaScript SDK, you can track js_error
events like this:
cont error = new Error("Something went wrong");eventvisor.track("js_error", error);
Benefits#
Because errors are now tracked via Eventvisor, you can benefit from:
...and more out of the box.