So, I added this image, hoping it would help :

My question is: What is the point of doing this? I have created my global exception class(with my own messages), I have raised it in a method of a global class and I have also caught this exception - and I have done all these without giving that particular method the exception, so does it help in any way to give a method exceptions?
Short update, this is my method code:

A coworker told me to give the method an exception parameter instead of writing the code from picture 2. If I do so, I don't see any changes and this is why I do not see the point of doing what is in the first picture.
This is a very good question. Because of the overhead, such exceptions create either by creating them, adding them, linking them to a message-class and throwing/catching them, it really, also for me, seems sometimes a kind of "shooting rockets at birds". Most things can really be caught by catching CX_ROOT.
Nevertheless there are really cases, where it is important to distinguish between exceptions, and therefore it is a nice-oop-standard to create some own,
If:
In the end this question is some kind of "best practice/best usecase" question and I also would be glad to see some other answers, which can pinpoint to other points of view about this topic.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With