I prefer to have the exception handling logic further up in the call stack, near the main method. I like this approach... However, I created a thread where some of its method calls inside run() may throw exceptions. I would really like to see if there is a way that these exceptions can be thrown back up to the parent thread? The best I could think of is setting a variable inside the object that implements Runnable
. This variable is a string that contains the Error Message, which then uses a class loader to correctly re-create the same exception in the parent thread.
What I would like to know, is there a less messy way of getting what I want here? (to be able to make sure that any exception thrown in a child thread is handled with the same exception handling logic as though it was running in the main thread/code re-use).