N/error Module
Use the N/error module to create custom SuiteScript errors that you can use in try-catch statements to abort script execution. Note that this module doesn't provide functionality to throw custom errors; however, you can include logic such as try-catch statements in your script to throw custom SuiteScript errors.
In This Help Topic
For more information about additional error logging capabilities, see the N/log Module.
N/error Module Members
Member Type |
Name |
Return Type / Value Type |
Supported Script Types |
Description |
---|---|---|---|---|
Object |
Object |
Server scripts |
Encapsulates a custom SuiteScript error for any server script type. |
|
Method |
Server scripts |
Creates a new error.SuiteScriptError object. |
||
Enum |
enum |
Server scripts |
Holds the string values for error types. Use this enum to set the value for the SuiteScriptError.name parameter of the error.create(options) method. This sets the value of the SuiteScriptError.type property. |
SuiteScriptError Object Members
Member Type |
Name |
Return Type / Value Type |
Supported Script Types |
Description |
---|---|---|---|---|
Property |
string (read-only) |
Server scripts |
Cause of the error. |
|
string (read-only) |
Server scripts |
Error ID that is automatically generated when a new error is created. |
||
string (read-only) |
Server scripts |
Error message text displayed in the Details column of the Execution Log. Set from the |
||
string (read-only) |
Server scripts |
Error name or error code. Set from the |
||
boolean (read-only) |
Server scripts |
Suppresses email notification when set to true. Set from the |
||
Array of strings (read-only) |
Server scripts |
List of method calls that the script is executing when the error is thrown. |
||
error.Type (read-only) |
Server scripts |
Error type (error.SuiteScriptError). |