Catch errors

Technologies > Software Engineering Techniques > Software Engineer Views > Illustrate Error Handling

This example illustrates handling of workflow rule errors. By default, Workflow.handleError() displays a standard error message if the workflow rule execution fails:

try {
Workflow.callMethod(...);
} catch (e) {
Workflow. handleError (e);
}


In the workflow rule, create a new ExceptionBase object and set a user-friendly error message:

try {
... // do something that throws a non-ExceptionBase exception.
} catch (IOException originalException) {

String errorMessage = "My user-friendly error message";
ExceptionBase exception = new ExceptionBase(null, errorMessage, originalException);
throw exception;
}


The workflow rule container will log the thrown exception to archibus.log and afm_wf_log , translate the error message, and propagate the exception to the client. The client then opens the error dialog and shows the user-friendly message.

View: http://localhost:8080/archibus/schema/ab-products/solutions/programming/error/ab-ex-prg-error.axvw