Invokes a function with error handling: returns its result, or reports the error (via the error
callback) and returns undefined if it throws.
When to use: prefer this for a one-off inline block you want to run immediately under error protection. If you instead need a callback to pass elsewhere and reuse, wrap it once with Monitor.monitor.
Wraps a function so that, when called, any thrown error is caught and reported (via the error callback) instead of propagating. The wrapper keeps the same signature as the input function.
When to use: prefer this when you need a reusable monitored callback to hand to something
that invokes it later, possibly multiple times — an event listener, setTimeout, an observable
subscription. For a one-shot inline block, use Monitor.callMonitored instead.
The function to wrap.
A function with the same signature that never throws (errors are collected instead).
TypeScript method decorator that routes a class method through Monitor.monitor, so any
error it throws is caught and reported instead of propagating to the caller. Apply it as
@monitored on the method (it replaces the method's descriptor value with the monitored
wrapper).
When to use: prefer this for class methods that are entry points from outside the SDK (public API methods, lifecycle callbacks) where an internal error must never reach the host application. For standalone functions or inline blocks, use Monitor.monitor or Monitor.callMonitored instead.
Reports an error directly: logs it to the console when debug mode is enabled, then forwards it to the error callback. Used internally by Monitor.monitor/Monitor.callMonitored, but can also be called to report an error caught elsewhere.
When to use: prefer this when you already hold an error value and only need to route it to
telemetry — e.g. a promise rejection, which monitor/callMonitored do not catch (they only
handle synchronous throws).
The error to report.
An isolated monitor, as returned by createMonitor.