[Logo]
Forums Register Login
NX: MyException Class
Hi,
Has anyone considered this way of handling exceptions
from a method which throws a subset of the exceptions
that are considered desirable? And if not, what are the
objections to this idea?

Now, the method which calls Data.read() simply
checks that myException.vector.size() > 0 and then
myException.vector.elementAt(0) for the
actual exception, and asks another method
to throw that actual exception for it.

In this way, I try to buffer and insulate the rest of the application
from the bad exception capabilities of the given class. What
were inproperly handled exceptions, only throwing some UselessException,
now allows me to get all types of exceptions, particularly IOExceptions.
thanks,
Javini Javono
Hi Javini,
I have not seen this suggested before. I don't understand how you use this class. My understanding based on your description would have been something more like:

I don't really understand why you are passing an instance of MyException into your throwThis() method. If MyException is a singleton, surely that method could be made static and could refer to the one and only instance of MyException?
I have to admit that this seems a bit cumbersome to me. If you want to get back to the root exception, wouldn't it be easier to wrap the exception inside your own RuntimeException and just catch that in the calling class?
Regards, Andrew
 
Originally posted by Andrew Monkhouse:
I have not seen this suggested before. I don't understand how you use this class. My understanding based on your description would have been something more like:


Hi,
Yes, that's the general concept I was imparting (and not the details of the coding outline).
Originally posted by Andrew Monkhouse:
I have to admit that this seems a bit cumbersome to me. If you want to get back to the root exception, wouldn't it be easier to wrap the exception inside your own RuntimeException and just catch that in the calling class?

Hi,
That is the core of my perhaps ill-phrased question. When you extract out the root
exception, do you subject it to a series of tests, or do you simply log it and move
forward?
Also, the above idea I posted might, perhaps, as I have not implemented it yet, make
it easier for those who wish to have any exception reported back all the way to the
client; and, if it is reported back to the client, it would make more sense, perhaps,
to simulate standard exception handling.
Thanks,
Javini Javono
Wink, wink, nudge, nudge, say no more ... https://richsoil.com/cards



All times above are in ranch (not your local) time.
The current ranch time is
Dec 14, 2017 23:49:40.