#14 C++ exceptions lose field contents

Rel_3.x
closed
Dieter Moroff
Generator (29)
7
2005-03-10
2005-03-04
vpussel
No

Problem 1)
the fields of modelled exception classes cannot be
initialized via ctor. Problem occurs in Java and in C++
Work around: the exception class is instantiated, then
the fields are set, then the exception is thrown.
Example in C++

MyException ex;
ex.setArg(someValue);
throw ex;

this procudes many extra lines of code.
Preferrably, this should read:

throw MyException ex(someValue)

where the ctor arguments are in same order as the
fields in class declaration.

Problem 2)
In C++, the workaround invokes exceptions' copy ctor -
which does NOT COPY the fields. This is serious show
stopper.

Discussion

  • vpussel
    vpussel
    2005-03-04

    • priority: 5 --> 7
     
  • Dieter Moroff
    Dieter Moroff
    2005-03-10

    Logged In: YES
    user_id=555111

    Fixed with 1.4.1

     
  • Dieter Moroff
    Dieter Moroff
    2005-03-10

    • status: open --> closed