in reply to Error handling on_fault and return params to the caller file (abc.mp)
The RPC::Any package-family has an interesting approach to a similar problem. The outer-level server framework wraps the handler-routines in an exception-handling block, and it also defines a set of structured error classes. If any handler encounters either an impossible situation or a bug, it throws an exception. The exception is caught and an error-response is returned. Because of the fact that you can throw objects, not just strings, the response can be quite customized because the “catcher” has more than just a string to work with. You might want to take a look at what they did as a source of good ideas. Also Exception::Class. It worked really well for me ... came out very clean and straightforward.