This blog will show how to do error handling in REST Adapter. The REST adapter supports Custom Error Handling when used as Sender or receiver.
You can use a custom error handling to define how the adapter will react to certain error codes with custom result messages. Besides, you can create error conditions based on the content of the message data.
In this example when PI will have a mapping error, it will send the custom message as a response to the user. This is simple error handling but it should be good to understand the mechanism.