IlsException
Category
Utility class
Inheritance Path
IlsException
This class is the base class for all exceptions thrown in the Server library. All exceptions that are thrown derive from this class (without adding any new methods) so that it is possible to catch a particular exception using the standard C++ mechanism.
Libraries
Synopsis
class IlsException
{
public:
IlsBoolean destroyMessage = IlsFalse);
IlsException&
operator=(const IlsException& rhs);
};
Constructors
IlsException(char* message = 0,
IlsBoolean destroyMessage = IlsFalse);
This constructor creates an instance of
IlsException. If a message is passed in as the first parameter, it can be used via the
getMessage member function in the catch statement to print out a message. If the parameter
destroyMessage is set to
IlsTrue, the message will be deleted (via
delete []) when the exception is deleted.
IlsException(const char* message);
This constructor creates an instance of
IlsException. The message parameter will not be deleted or copied. The message can be used via the
getMessage member function in the catch statement to print out a message.
IlsException(const IlsException& rhs);
This copy constructor copies an instance of a message. If the message in rhs is marked to be destroyed on deletion of rhs, the message is copied into the new instance.
Destructor
virtual ~IlsException();
This virtual destructor will delete the message it contains if the exception was created with the destroyMessage parameter set to IlsTrue.
Operators
IlsException& operator=(const IlsException& rhs);
This copy operator copies the exception rhs. If the message in rhs is marked to be destroyed on deletion of rhs, then the message is copied into the new instance.
operator const char*() const;
This operator returns the message, if any, contained in the exception.
Member Functions
const char* getMessage() const;
This member function returns the message, if any, contained in the exception. This can be used to print an error message, potentially containing extra information, when the exception is caught. An example of this is shown below:
try {
run();
}
catch (IlsOwnershipCycle exc) { // an ownership cycle
}
catch (IlsException exc) { // some other Rogue Wave Views exception
}
catch (...) { // a non Rogue Wave Views exception
}
void setMessage(const char* message);
This member function changes the message in an exception. If the old message is marked as deletable, then it is deleted and the new message is copied. The message is always copied when this member function is called.
See Also
Version 5.8
Copyright © 2014, Rogue Wave Software, Inc. All Rights Reserved.