onBug()
Environment: server.
To track bugs, we use onBug():
import { onBug } from 'telefunc'
onBug((err) => {
// ...
})This allows us, for example, to install the tracker code of some tracking service (Sentry, Bugsnag, Rollbar, ...).
onBug() is called:
- When a telefunction throws an error that is not
Abort(). (In other words, our telefunction has a bug.) - When Telefunc throws an error. (In other words, Telefunc has a bug).
throw Abort()does not triggeronBug(). It's expected thatthrow Abort()may be called (when some third-party erroneously calls a telefunction). In other words,throw Abort()isn't a bug.