tshad wrote:
If I do a:
throw(new Exception("This is an error"));
This gets handled correctly, but there is no stack information here.
Why is that?
No idea. You didn't show the code that's supposed to handle the exception.
That's where you'd expect the stack information to show up, no?
One well-known caveat is that rethrowing an exception "the wrong way" will
destroy the stack. If you do this:
..
} catch (Exception e) {
throw e;
}
The original exception's call stack is trashed and the exception will
instead appear to originate from the catch block. The correct syntax is
..
} catch (Exception e) {
throw;
}
That is assuming that catching and rethrowing the exception is the right
thing to do in the first place, of course, which it isn't that often.
Other than that, you'll have to be more specific.
--
J.