Error Propagation
You should raise all user-facing error messages using the N/error SuiteScript module. For details on this module, see N/error Module.
In all user-facing errors, you must set the name property to FICONNECTIVITY_USER_ERROR. Errors not raised with the FICONNECTIVITY_USER_ERROR name property, as well as any exception not handled, are not surfaced to users. Instead, NetSuite displays a generic error message on the Format Profile page. Details about the error are available in the plug-in’s execution log.
The following sample code illustrates how to raise a user-facing error:
throw error.create({ // error variable is the imported 'N/error' module
name: 'FICONNECTIVITY_USER_ERROR',
message: 'This message will be displayed on the Format Profile page'
});
The next sample code illustrates how to raise a non user-facing error:
throw 'This message will not be displayed on the Format Profile page';