abort
- AbstractItem.abort(message)
- Domain:
client
- Language:
javascript
- Class:
Description
Use the abort method to throw an exception. It can be useful when you
need to abort the execution of certain on_before events.
Parameters
Parameter |
Type |
Description |
|---|---|---|
|
|
The text of the exception to be thrown. |
Raises
Throws an exception with the message:
execution aborted: <message>
Example
The following code throws an exception with the text
execution aborted: invoice_table - a quantity value is required:
function on_before_post(item) {
if (item.quantity.value === 0) {
item.abort('a quantity value is required');
}
}