1 -- File: Standard_Failure.cdl
2 -- Created: Thu Sep 5 17:21:09 1991
3 -- Author: Philippe COICADAN
5 -- Revised J.P. TIRAULT
6 -- New organization of standard Package (August 1992)
8 ---Copyright: Matra Datavision 1991, 1992
11 class Failure from Standard inherits Transient from Standard
14 -- Forms the root of the entire exception hierarchy.
17 CString from Standard,
18 OStream from Standard,
22 NoSuchObject from Standard
26 Create returns mutable Failure;
28 -- Creates a status object of type "Failure".
30 ---C++: alias "Standard_EXPORT Standard_Failure (const Standard_Failure& f);"
32 Create (aString: CString) returns mutable Failure;
34 -- Creates a status object of type "Failure".
36 ---C++: alias "Standard_EXPORT Standard_Failure& operator= (const Standard_Failure& f);"
42 Print (me; s: in out OStream);
44 -- Prints on the stream <s> the exception name followed by
48 -- The operator "OStream& operator<< (Standard_OStream&,
49 -- Handle(Standard_Failure)&)"
50 -- is implemented. (This operator uses the method Print)
52 ---C++: alias operator<<
54 GetMessageString (me) returns CString from Standard;
55 ---Purpose: Returns error message
58 SetMessageString (me: mutable; aMessage: CString);
59 ---Purpose: Sets error message
61 Reraise (me: mutable);
62 Reraise (me: mutable; aMessage: CString);
63 Reraise (me: mutable; aReason: SStream);
64 ---Purpose: Reraises a caught exception and changes its error message.
67 Raise (myclass; aMessage: CString = "") ;
68 ---Purpose: Raises an exception of type "Failure" and associates
69 -- an error message to it. The message can be printed
70 -- in an exception handler.
74 Raise (myclass; aReason: SStream) ;
75 ---Purpose: Raises an exception of type "Failure" and associates
76 -- an error message to it. The message can be constructed
80 NewInstance(myclass; aMessage: CString) returns mutable Failure;
81 ---Purpose: Used to construct an instance of the exception object
82 -- as a handle. Shall be used to protect against possible
83 -- construction of exception object in C stack -- that is
84 -- dangerous since some of methods require that object
85 -- was allocated dynamically.
88 ---Purpose: Used to throw CASCADE exception from C signal handler.
89 -- On platforms that do not allow throwing C++ exceptions
90 -- from this handler (e.g. Linux), uses longjump to get to
91 -- the current active signal handler, and only then is
92 -- converted to C++ exception.
93 ---Level: Advanced, not for regular use
95 Caught (myclass) returns mutable Failure raises NoSuchObject;
96 ---Purpose: Returns the last caught exception.
97 -- Needed when exceptions are emulated by C longjumps,
98 -- in other cases is also provided for compatibility.
100 Throw (me) is virtual protected;
101 ---Purpose: Used only if standard C++ exceptions are used.
102 -- Throws exception of the same type as this by C++ throw,
103 -- and stores current object as last thrown exception,
104 -- to be accessible by method Caught()
110 end Failure from Standard;