In error handler,
1. Replace the error code with the customized error code by xpath ./ctx:errorCode in fault2. Replace reason with your customized error message by xpath ./ctx:reason in fault
3. Replace the node contents by xpath . in body with $fault
4. Put a Reply at the end of error handling and select the radio button With Failure
For more detail about error handling in OSB, you can refer the follow blog of Eric.