R
Razzie
Hi all,
The title of this post may sound a bit weird, but I was wondering about the
following nonetheless.
I have a class libray containing, say, 4 classes: A, B, C, D. Class A
somehow has a reference to B, B has a reference to C, and C to D.
If an exception happens in class D, I would like class A to get a
notification of this (all execution on classes B to D should be terminated).
I am wondering how to do this. The following seems like a bad idea:
class D {
{
try(...)
catch(SomeException ex)
throw new SomeException("Error in D");
}
class C
{
D d = new D();
try
{ d.doSomething(); }
catch(SomeException ex)
{ throw new SomeException(ex.Message); }
}
and catch THAT exception in B, and throw it to A. I think you get the idea
I'm quite sure this is a bad idea. But how should I structure it then? No
error handling at all in classes B to D is even worse. I hope someone can
give me a good idea.
Thanks!
Razzie
The title of this post may sound a bit weird, but I was wondering about the
following nonetheless.
I have a class libray containing, say, 4 classes: A, B, C, D. Class A
somehow has a reference to B, B has a reference to C, and C to D.
If an exception happens in class D, I would like class A to get a
notification of this (all execution on classes B to D should be terminated).
I am wondering how to do this. The following seems like a bad idea:
class D {
{
try(...)
catch(SomeException ex)
throw new SomeException("Error in D");
}
class C
{
D d = new D();
try
{ d.doSomething(); }
catch(SomeException ex)
{ throw new SomeException(ex.Message); }
}
and catch THAT exception in B, and throw it to A. I think you get the idea

error handling at all in classes B to D is even worse. I hope someone can
give me a good idea.
Thanks!
Razzie