Re: Structured exception information



Maciej Sobczak <no.spam@xxxxxxxxxxx> writes:

If there are problems during the execution of the constructor function,
the exception is raised, so that there is no X object in a bad state.
How can I pass some error information from the constructor function out,
so that it's used when the exception is handled?

There is no good way to do this in Ada. You can attach any information
you like to an exception, if you are willing to encode it as a String --
but then you lose static type checking. You can put the info in a
global variable, but that's bad for several reasons (not task safe,
can be accessed outside of any handler, ...). You can put the info in a
Task_Attribute, but that's rather a pain -- verbose and inefficient.

- Bob
.