Modules
Objects/Functions
SuiteScript 2.0
{error}.create({message: {string*},name: {string*},notifyOff: {boolean}})
N/error Module
error.create()
Method Description:
Creates a new error.SuiteScriptError object.
Use the error.SuiteScriptError or error.UserEventError object in a try-catch statement to abort script execution.
Note this method creates a new error, but does not throw the error. Your script code will need to include logic to throw the error when appropriate.
Returns:
An error.SuiteScriptError object.
Supported Script Types:
Server scripts
For more information, see SuiteScript 2.0 Script Types.
Governance:
None
Module:
N/error Module
Since:
2015.2
Search NetSuite -
https://system.netsuite.com/app/help/helpcenter.nl?search=error.create(options)
Example:
// Code Example 1
//Add additional code
//...
// errorObj is a error.SuiteScriptError if this code is included in a server script that is not a user event script.
// errorObj is a error.UserEventError if this code is included in a user event script.
var custom_error = error.create({
name: 'MY_ERROR_CODE',
message: 'my custom error details',
notifyOff: false
});
log.debug("Error Code: " + custom_error.name); // 'Error Code: MY_ERROR_CODE' will be logged
//...
//Add additional code
//SOURCE: https://system.netsuite.com/app/help/helpcenter.nl?fid=section_4243803203.html