in reply to How do I report an error back to the user of my object?
However usually the client not only needs to know that something has gone wrong, but also what has gone wrong in order to handle the error-situation.
If you communicate that with a simple string (e.g. die "error1\n") then your client has to parse the caught exception (which is then just a string) and that is brittle and silly.
A much better approach would be using exception-objects from one of the frameworks that do all the heavy lifting for you.
I have made good experiences with Exception::Class.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: How do I report an error back to the user of my object?
by locked_user sundialsvc4 (Abbot) on Jun 06, 2012 at 02:11 UTC |