The error() method is for tracking custom errors.

Syntax

error(customError)

Parameters

customError

  1. Error you want to track. It may be string, Error, PromiseRejectionEvent, ErrorEvent or serializable Object.

Return value

void

Examples

Simple error

Smartlook.error('Error occured')

Serializable object

Smartlook.error({
    message: 'Error occured',
    type: 'internal',
})

Promise catch

try {
    await fetch(url)
} catch (error) {
    Smartlook.error(error)
}