Exception Handling
Rogue Wave® Server applications make use of exceptions for error handling. For example, if you try to remove an item from a list to which it does not belong, the exception IlsNotFound will be thrown.
Exceptions thrown by Rogue Wave Server are instances of classes that derive from IlsException. These classes are defined in the include files except.h and sexcept.h.
As illustrated below with the exception IlsNullPointerDereferencing, Rogue Wave Server catches exceptions according to the conventional C++ technique.
try {
// some code that may throw an exception
}
catch (IlsNullPointerDereferencing exception) {
// do something
}
catch (IlsException exception) {
// some other Rogue Wave Views Server exception
}
catch (...) {
// some non-Rogue Wave Views Server exception
}
Note that using exceptions requires that you strictly observe a certain number of rules when writing C++ code. Among other things, you have to be careful:
Not to throw exceptions while the initialization list of a constructor executes. Should this happen, the constructor might leave the object in an unspecified state, which could be lethal for the application.
Not to allocate new objects before an exception is to be thrown, unless you know exactly what you are doing. Since exceptions cause the C++ stack to be rolled back, the application might be unable to access these objects and, hence, to delete them.
Version 6.3
Copyright © 2018, Rogue Wave Software, Inc. All Rights Reserved.