diff options
author | Mark Spruiell <mes@zeroc.com> | 2002-05-14 18:44:07 +0000 |
---|---|---|
committer | Mark Spruiell <mes@zeroc.com> | 2002-05-14 18:44:07 +0000 |
commit | 64f1590349701e5a759ead38a27e3bf2f14443ec (patch) | |
tree | c89ad8745e79693471d2dbd60d626064c411004c /cpp/src/Ice/PluginManagerI.cpp | |
parent | fixes (diff) | |
download | ice-64f1590349701e5a759ead38a27e3bf2f14443ec.tar.bz2 ice-64f1590349701e5a759ead38a27e3bf2f14443ec.tar.xz ice-64f1590349701e5a759ead38a27e3bf2f14443ec.zip |
fixing exception handling in plug-in initialization
Diffstat (limited to 'cpp/src/Ice/PluginManagerI.cpp')
-rw-r--r-- | cpp/src/Ice/PluginManagerI.cpp | 34 |
1 files changed, 23 insertions, 11 deletions
diff --git a/cpp/src/Ice/PluginManagerI.cpp b/cpp/src/Ice/PluginManagerI.cpp index bc84f54f6a4..c9e2f6c25a0 100644 --- a/cpp/src/Ice/PluginManagerI.cpp +++ b/cpp/src/Ice/PluginManagerI.cpp @@ -144,15 +144,15 @@ Ice::PluginManagerI::loadPlugin(const string& name, const string& entryPoint, co DynamicLibrary::symbol_type sym = info.library->loadEntryPoint(entryPoint); if (sym == 0) { - Error out(_instance->logger()); + ostringstream out; string msg = info.library->getErrorMessage(); - out << "PluginManager: unable to load entry point `" << entryPoint << "'"; + out << "unable to load entry point `" << entryPoint << "'"; if (!msg.empty()) { out << ": " + msg; } - SystemException ex(__FILE__, __LINE__); - ex.error = getSystemErrno(); + PluginInitializationException ex(__FILE__, __LINE__); + ex.reason = out.str(); throw ex; } @@ -166,16 +166,28 @@ Ice::PluginManagerI::loadPlugin(const string& name, const string& entryPoint, co } catch (const Exception& ex) { - Error out(_instance->logger()); - out << "PluginManager: exception in entry point `" << entryPoint << "': " << ex.ice_name(); - throw; + // + // Do NOT propagate the exception from the entry point, + // because the library will be closed. + // + ostringstream out; + out << "exception in entry point `" << entryPoint << "'\n" + << "original exception:\n" + << ex; + PluginInitializationException e(__FILE__, __LINE__); + e.reason = out.str(); + throw e; } catch (...) { - Error out(_instance->logger()); - out << "PluginManager: unknown exception in entry point `" << entryPoint << "'"; - SystemException e(__FILE__, __LINE__); - e.error = 0; + // + // Do NOT propagate the exception from the entry point, + // because the library will be closed. + // + ostringstream out; + out << "unknown exception in entry point `" << entryPoint << "'\n"; + PluginInitializationException e(__FILE__, __LINE__); + e.reason = out.str(); throw e; } |