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 way and returns an error object in case 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