CARMA C++
|
Generic Carma variant of CORBA::UserException. More...
import "carma/util/UserException.idl";
Public Attributes | |
string | errorMsg |
string | fileName |
short | lineNo |
Generic Carma variant of CORBA::UserException.
This exception can be thrown over-the-wire from a CORBA server to a CORBA client. For the most part, it is useful for repackaging and rethrowing exceptions caught in CORBA server implementation methods. It allows one to communicate a server-side error back to the client.
To use you must first indicate that methods in your IDL interface can throw this exception:
After this is done, you can throw a UserException from your implementation:
Additional notes: As demonstrated above, this exception conforms to CARMA_EXCEPTION() semantics. Furthermore, the CORBA to C++ mapping for the strings in this exception guarantee that a deep copy of the string message and filename will be made. Thus the user need not worry about a string literal, ostringstream string, or std::string being destructed when the stack unwinding occurs from rethrowing a UserException. This is due to the fact that the generated exception structure uses a const char * mapping which in turn is used to construct String_var member variables. The String_var(const char *) constructor always makes a deep copy.
However, for the same reasons, there is only a single UserException constructor which requires strings to be input as const char *. Thus you cannot use UserException as flexibly as say carma::util::ErrorException which provides alternative constructors for std::string and std::ostringstream objects. You can however, always use the str() and c_str() methods from these classes to copy the internal contents. For example:
Definition at line 75 of file UserException.idl.