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

error.SuiteScriptError

Object

Server scripts

Encapsulates a custom SuiteScript error for any server script type.

Method

error.create(options)

error.SuiteScriptError

Server scripts

Creates a new error.SuiteScriptError object.

Enum

error.Type

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

SuiteScriptError.cause

string (read-only)

Server scripts

Cause of the error.

SuiteScriptError.id

string (read-only)

Server scripts

Error ID that is automatically generated when a new error is created.

SuiteScriptError.message

string (read-only)

Server scripts

Error message text displayed in the Details column of the Execution Log. Set from the options.message parameter when you create a new error using error.create(options)

SuiteScriptError.name

string (read-only)

Server scripts

Error name or error code. Set from the options.name parameter when you create a new error using error.create(options).

SuiteScriptError.notifyOff

boolean (read-only)

Server scripts

Suppresses email notification when set to true. Set from the options.notifyOff parameter when you create a new error using error.create(options)

SuiteScriptError.stack

Array of strings (read-only)

Server scripts

List of method calls that the script is executing when the error is thrown.

SuiteScriptError.type

error.Type (read-only)

Server scripts

Error type (error.SuiteScriptError).

Related Topics

General Notices