Gyoto
|
Error handling. More...
#include <string>
Go to the source code of this file.
Classes | |
class | Gyoto::Error |
Class for thowing exceptions. More... | |
Namespaces | |
Gyoto | |
Namespace for the Gyoto library. | |
Constant Groups | |
Gyoto | |
Namespace for the Gyoto library. | |
Functions | |
void | Gyoto::throwError (std::string) |
Throw a Gyoto::Error. | |
Error handling.
Gyoto dlopens its plug-ins. The throw/catch C++ mechanism cannot pass the dlopen boundary. The Gyoto::Error mechanism alleviates this C++ language limitation.
Every Gyoto method (either in the main Gyoto library or in a Gyoto plug-in) should check for possible error conditions and throw adequate Gyoto::Error exceptions through the Gyoto::Error::throw() function. For instance:
If the main code has set Gyoto::Error::handler_t error handler using Gyoto::Error::setHandler(), these errors will then be passed to it. Else, the Error is C++-thrown at the main Gyoto library level, above the dlopen boundary.
The main code can then catch these exceptions and act appropriately, for instance: