Create a Custom Error

The following sample shows how to create a custom error.

Note:

This sample script uses the require function so that you can copy it into the SuiteScript Debugger and test it. You must use the define function in an entry point script (the script you attach to a script record and deploy). For more information, see SuiteScript 2.x Script Basics and SuiteScript 2.x Script Types.

          /**
 * @NApiVersion 2.x
 */

// This script creates a custom error.
require(['N/error'], function(error) {
    function createError() {
        var myCustomError = error.create({
            name: 'MY_ERROR_CODE',
            message: 'My custom error details',
            notifyOff: true
        });
    }
    createError();
}); 

        

General Notices