Exceptions API
The Exceptions API can be used to create exceptions within JavaScript code.
See OAuth2 Exceptions for exceptions thrown by an OAuth2 callback.
Creates an exception that is marked as trusted, meaning that the message will be returned to the client even if Suppress Error Details is enabled.
Inputs:
theMessage
– The error messageOutputs:
Example:
throw Exceptions.newTrustedException('Database is unavailable');
Creates an exception that is marked as trusted, meaning that the message will be returned to the client even if Suppress Error Details is enabled.
Inputs:
theStatusCode
– The HTTP status code that should be returned to the clienttheMessage
– The error messageOutputs:
Example:
throw Exceptions.newTrustedException(500, 'Database is unavailable');