Hi All,
I have a perl module file which uses large number of different types exceptions. what I mean by it, if there is a failure then it can throw any of those exception. Now, what I want is, it to throw only one type of exception whatever the error may be. This is needed because i wanted to collect some info in case this file throws an exception. The info collected is same irrespective of exception thrown. Information is collected by method defined on that exception. Now the problem is some of these exceptions also are used by other modules. Information that needs to be collected is different for each of the module.
Solution that I thought of:
I can put everything in try/catch block and throw only one type of exception. Also, subclass this exception from each of the exceptions that module is using. But it is going to be very messy and i dont like the idea.
Please let me know if there is a better way to do it. I want a solution which will require minimal changes to existing code
In reply to Need help with exceptions by rawat011
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |