Introduction to Error handling mechanisms
What is an error binding
In Application Systems, exceptions (Exception) are often present. These exceptions are usually grouped into 2 classes, one being Run-time exceptions (Runtime Exception), which is usually caused by code defects, and the other is business logic exceptions (Business Exception), which are usually due to inaccurate, imperfect, The application system is unable to process the resulting.
For the system developers, the Run-time anomaly is easily captured and processed accordingly, the main way to deal with it is to ignore, after the packaging, to throw, log and so on. For business logic-related exceptions, it is difficult for developers to analyze and process, the best way is to provide these exception information to the application of the caller, by the caller of these business logic related processing. The business logic error that the application system passes to the caller should not be an exception class, rather, it is a business-related structured exception data, so that callers do not care about the implementation of the service and the programming language, simply focus on the returned data (the correct result or the exception data) and handle the data accordingly. In addition, the format of these data is usually independent of the programming language, which is supported by the error binding (Fault Binding) attribute of the Websphere Adapter. In other words, an error binding is a mechanism provided by WebSphere Adapter to deal with business logic exceptions, which distinguishes run-time and business logic exceptions, and provides more meaningful error data to the caller of the application system through this error handling mechanism.
Note: The error binding mechanism currently works only in the WebSphere Process server and in the WebSphere Application Server Feature Pack environment.
Error Binding implementation principle
Error binding is an error-handling mechanism supported by Websphere Adapter, used in outbound scenarios. An error binding has several elements:
Error selector (Fault selector)
Error name (Fault name)
Bad binding type (Fault binding type)
Error (Fault data)
When the WebSphere Adapter encounters an exception, the WebSphere Adapter first invokes the error selector to determine if the exception is an error that is supported by WebSphere Adapter, if it is not, does not, and if so, invokes the error selector to generate the corresponding error name. It then finds the corresponding error binding type based on the wrong name, and finally calls the wrong binding type to generate the appropriate error data and returns the error data to the caller. Figure 1 is the flowchart for the entire error-binding process.
Figure 1. Error binding flowchart