Programmer's Guide > Using the AOM > Using Java to Access the AOM > Java Interface Exceptions
  
Java Interface Exceptions
Several AOM and DOM methods will raise an exception if an error occurs. The following tables summarize the DOM and AOM exception classes:
DOM Exception Classes
Exception Class
Description
DOMException
Raised by core DOM methods.
EventException
Raised by DOM event methods.
RangeException
Raised by DOM range methods.
AOM Exception Classes
Exception Class
Description
AclException
Raised by methods in the Acl interface.
AOMException
Raised by general AOM methods.
TableException
Raised by table-related methods.
WindowException
Raised by Window and other user interface related methods.
In the Arbortext Editor Java interface, all DOM and AOM exceptions are subclasses of java.lang.RuntimeException and inherit the getMessage method from the java.lang.Throwable interface. The getMessage method can be used to retrieve an error message associated with the exception.
Most DOM and AOM exception classes define a code field that can be accessed to determine the numeric error code associated with the exception (the exception is the AOMException class). Symbolic names for the error codes listed with each exception interface description in Interface Overview are available as class constants. For example, the following checks for a specific DOM error code (NO_MODIFICATION_ALLOWED_ERR):
try {
node.insertBefore(newNode, refNode);
}
catch (DOMException e) {
if (e.code == DOMException.NO_MODIFICATION_ALLOWED_ERR) {
// document is read only
}
}
If your Java program does not catch an exception, its execution will be aborted and an error message will be displayed.