This site contains the documentation that is relevant to older WSO2 product versions and offerings.
For the latest WSO2 documentation, visit https://wso2.com/documentation/.

Error Handling and Error Codes

The main role of an Enterprise Service Bus (ESB) is to act as the backbone of an organization’s service-oriented architecture. It is the spine through which all the systems and applications within the enterprise (and external applications that integrate with the enterprise) communicate with each other. As such, an ESB often has to deal with many wire level protocols, messaging standards, and remote APIs. But applications and networks can be full of errors. Applications crash. Network routers and links get into states where they cannot pass messages through with the expected efficiency. These error conditions are very likely to cause a fault or trigger a runtime exception in the ESB.

Using Fault Sequences

WSO2 ESB provides fault sequences for dealing with such errors. A fault sequence is a collection of mediators just like any other sequence, and it can be associated with another sequence or a proxy service. When the sequence or the proxy service encounters an error during mediation or while forwarding a message, the message that triggered the error is delegated to the specified fault sequence. Using the available mediators it is possible to log the erroneous message, forward it to a special error-tracking service, and send a SOAP fault back to the client indicating the error or even send an email to the system admin.

It is not mandatory to associate each sequence and proxy service with a fault sequence. In situations where a fault sequence is not specified explicitly, a default fault sequence will be used to handle errors. Sample 4: Introduction to Error Handling shows how to specify a fault sequence with a regular mediation sequence.

Whenever an error occurs in WSO2 ESB, the mediation engine attempts to provide as much information as possible on the error to the user by initializing the following properties on the erroneous message:

  • ERROR_CODE
  • ERROR_MESSAGE
  • ERROR_DETAIL
  • ERROR_EXCEPTION      

Within the fault sequence, you can access these property values using the get-property XPath function. Sample 4 uses the log mediator as follows to log the actual error message:  
<log level="custom">
  <property name="text" value="An unexpected error occured"/>
    <property name="message" expression="get-property('ERROR_MESSAGE')"/>      
</log>  

Note how the ERROR_MESSAGE property is being used to get the error message text. If you want to customize the error message that is sent back to the client, you can use the makefault mediator as demonstrated in Sample 5: Creating SOAP Fault Messages and Changing the Direction of a Message.

Transport Error Codes

 

Error Code Detail
101000Receiver input/output error sending
101001Receiver input/output error receiving
101500Sender input/output error sending
101501Sender input/output error receiving
101503Connection failed
101504Connection timed out
101505Connection closed
101506NHTTP protocol violation
101507

Connection canceled

101508Connection timed out
101509Send abort
101510Response processing failed

Endpoint Failures

This section describes the error codes for endpoint failures. For more information on handling endpoint errors, see Endpoint Error Handling.

General Errors

 

Error CodeDetail
303000Load Balance endpoint is not ready to connect
303000Recipient List Endpoint is not ready
303000Failover endpoint is not ready to connect
303001Address Endpoint is not Ready to connect
303002WSDL Address is not ready to connect

Failure on Endpoint in the Session

 

Error CodeDetail
309001Session aware load balance endpoint, No ready child endpoints
309002Session aware load balance endpoint, Invalid reference
309003Session aware load balance endpoint, Failed session

Non-Fatal Warnings

 

Error CodeDetail
303100A failover occurred in a Load balance endpoint
304100A failover occurred in a Failover endpoint

Referring Real Endpoint is Null

 

Error CodeDetail
305100Indirect endpoint not ready

Callout Operation Failed

 

Error CodeDetail
401000 Callout operation failed (from the callout mediator)

For information on best practices for handling errors in WSO2 ESB, see WSO2 ESB by Example - Best practices for error handling on the WSO2 ESB.