Skip to content

Class: ErrorHandler

A class which allows asyncronously thrown errors to be consumed and handled

Methods

off()

ts
off(listener?: (err: Error) => void): ErrorHandler;

Unsubscribe an error handler.

Parameters

ParameterTypeDescription
listener?(err: Error) => voidThe callback to be unsubscribed

Returns

ErrorHandler


on()

ts
on(listener: (err: Error) => void, ctx?: any): ErrorHandler;

Subscribe an error handler.

Parameters

ParameterTypeDescription
listener(err: Error) => voidThe callback to be called when the error is thrown
ctx?anyThe this context to be used when calling the callback

Returns

ErrorHandler


once()

ts
once(listener: (err: Error) => void, ctx?: any): ErrorHandler;

Subscribe an error handler for only the next error.

Parameters

ParameterTypeDescription
listener(err: Error) => voidThe callback to be called when the error is thrown
ctx?anyThe this context to be used when calling the callback

Returns

ErrorHandler