Error Handling

You can have API Server handle exception conditions and errors that some calls might throw using one of the following methods:
lac42
You can have API Server handle exception conditions and errors that some calls might throw using one of the following methods:
  • Have it catch and process the condition or error. Surround your code, including calls to Java, with try/catch blocks. For example:
    try {
        // This will throw a NullPointerException
        Java.type("java.lang.Long").parseLong(null);
    }
    catch(e) {
        // The exception is caught here
        log.debug("Got an exception: " + e);
    }
  • Have it invoke error event handlers that modify the condition or error.
    For more information about how to create error event handlers, see Event Handlers.