dreamwork.exceptions
Functions
dreamwork.exceptions.call | Calls the function in protected mode, errors are displayed and do not propagate. |
dreamwork.exceptions.catch | xpcall message handler for errors that are going to be rethrown. |
dreamwork.exceptions.handler | xpcall message handler that converts the error into an Error, displays it and returns it. |
#dreamwork.exceptions.call
function dreamwork.exceptions.call(fn: function, ...: any): boolean, any
Calls the function in protected mode, errors are displayed and do not propagate.
Same as xpcall( fn, dreamwork.exceptions.handler, ... ), use it for callbacks whose errors must not break the caller (hooks, timers, network receivers, ...).
Parameters
| Name | Type | Description |
|---|---|---|
fn | function | The function to call. |
... | any | The arguments to pass to the function. |
Returns
| Type | Name | Description |
|---|---|---|
boolean | success | true if the function did not raise an error. |
any | ... | The function results on success, the displayed Error otherwise. |
#dreamwork.exceptions.catch
function dreamwork.exceptions.catch(error_value: any): Error | any
xpcall message handler for errors that are going to be rethrown.
Works like toError, but values that are neither errors nor strings (signals like ACTION_CANCEL) are returned as is, so rethrowing them keeps their identity, the same way error throws them.
Parameters
| Name | Type | Description |
|---|---|---|
error_value | any | The error value to handle. |
Returns
| Type | Name | Description |
|---|---|---|
Error | any | error_object |
#dreamwork.exceptions.handler
function dreamwork.exceptions.handler(error_value: any): Error
xpcall message handler that converts the error into an Error, displays it and returns it.
Parameters
| Name | Type | Description |
|---|---|---|
error_value | any | The error value to handle. |
Returns
| Type | Name | Description |
|---|---|---|
Error | error_object |