+ 26
Throw multiple exceptions at the same time.
Is it possible to throw multiple exceptions at the same time in Java? maybe a work around the language features?
5 odpowiedzi
+ 24
Ulisses Cruz : I want to invoke a combination of different exception handlers at the same time... maybe it can be achieved by Events. 🤔🤔 yeah I can implement a similar behaviour using Events I think
+ 4
Yes. You can throw an ARRAY out of Bounds exception, a .io* Exception, and others. Have done so. Such cluttered console! :)
+ 1
I don't think it is possible.
Why would you do that?
+ 1
I advise you to use events so, throwing exceptions is expensive (slow) to be used with purpose. Exceptions should really be thrown, when something goes wrong (unexpected event or illegal state). I would say avoid exceptions where you can. Building some application mechanics which is controlled by (expects) throwables is not a good idea. First it may seem handy and fast, but it is quite the opposite.
+ 1
processing exception runtime does something known as stack unwind, which may finish in Os, what known as program failure. you can re throw something on this way, but you can not enter this special mode twice