Re: Structured exception information



Maciej Sobczak <no.spam@xxxxxxxxxxx> writes:

X : My_Type := My_Constructor(Some_Parameters);

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?

Why do you want to? Generally, all you can do is report the error to
the user.

Can you give a detailed example of passing more complex information
that is actually used?

--
-- Stephe
.



Relevant Pages

  • Re: Application.Exit problem
    ... > I need to abort execution during start up, ... > unhandled exception will impress our customers:) Can't say that I ... Don't forget that until your constructor has returned, ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: DbC & Exceptions & Style
    ... exception. ... Different ways the constructor can fail ... to avoid writing code that converts GUI data into objects, ... All domain objects must now provide a default constructor. ...
    (comp.object)
  • Re: Controlled types and exception safety
    ... >> propagate an exception. ... >> For an Adjust invoked as part of an assignment operation, ... But a user-defined constructor is ... a user-defined constructor has just turned on the ...
    (comp.lang.ada)
  • Re: is such exception handling approach good?
    ... There is nothing wrong with throwing from constructor. ... It may be a good design, it may not be a good design from user's point ... resource API to free-up the resource on exception. ... change something - that is not initialization. ...
    (microsoft.public.vc.language)
  • Re: Question concerning object-oriented programming
    ... constructor the inspectof the state fails to verify key ... Better yet the constructor could throw an exception. ... opposed to stateless) object can know if it is in an invalid state. ...
    (comp.programming)