nothrowCall
Syntax
nothrowCall(func, args...)
Alias: nothrow
Details
Calls a function with the specified parameters. The syntax is the same as call.
Unlike call, nothrowCall does not throw exceptions
during execution, but it will throw an exception if the number of arguments does not
match.
Parameters
func is a function.
args are the required parameters of func.
Returns
The result depends on the return value of func(args).
Examples
When preparing the DolphinDB system environment, you need to clean up the
environment, such as removing existing stream tables. However, it is sometimes
unclear whether a given stream table exists. If dropStreamTable is called directly, an
exception will be thrown when the table does not exist. In this case,
nothrowCall can be used to ignore the exception.
The following example assumes that the stream table named orderData does not exist:
dropStreamTable(`orderData)
// Throw an exception: Can't find stream table orderData
nothrowCall(dropStreamTable, `orderData)
// The function runs without throwing an exception.
Related Function: call
