callSafe

[ Function ]

public static callSafe<T extends object, A extends any[]>(
   callback: Callback.ICallback<T, A> | null | undefined,
   thisArg: T | null | undefined,
   ...args: A
): Error | undefined;

Calls a Callback function in a safe manner and returns an error object in the event of an exception.

Parameter

Name

Type

Description

callback

Callback.ICallback<T, A> | null | undefined

The Callback function to be called

thisArg

T | null | undefined

This pointer to an object that is to be passed as caller.

…args

A

Arguments to be passed to the callback function.

Return value

Type

Description

Error | undefined

Returns undefined or the error object of an exception.

callSafe 1:

Available from version 1.10