diff options
| author | Mike Buland <eichlan@xagasoft.com> | 2007-01-30 22:40:07 +0000 |
|---|---|---|
| committer | Mike Buland <eichlan@xagasoft.com> | 2007-01-30 22:40:07 +0000 |
| commit | e82431fb4f5155220c8c0d3f7d11c6d60ab475a4 (patch) | |
| tree | a8d63bdb73fdb6aa280f7b4f4441d48a23fe0884 | |
| parent | 45c86417cbac76159918e1429a391e2eb510bc32 (diff) | |
| download | libbu++-e82431fb4f5155220c8c0d3f7d11c6d60ab475a4.tar.gz libbu++-e82431fb4f5155220c8c0d3f7d11c6d60ab475a4.tar.bz2 libbu++-e82431fb4f5155220c8c0d3f7d11c6d60ab475a4.tar.xz libbu++-e82431fb4f5155220c8c0d3f7d11c6d60ab475a4.zip | |
Hey, Plugger doesn't kill your program with exit, it just throws an exception.
| -rw-r--r-- | src/exceptions.cpp | 2 | ||||
| -rw-r--r-- | src/exceptions.h | 1 | ||||
| -rw-r--r-- | src/plugger.h | 7 |
3 files changed, 6 insertions, 4 deletions
diff --git a/src/exceptions.cpp b/src/exceptions.cpp index 9696af8..ce79a5e 100644 --- a/src/exceptions.cpp +++ b/src/exceptions.cpp | |||
| @@ -4,3 +4,5 @@ | |||
| 4 | subExceptionDef( XmlException ) | 4 | subExceptionDef( XmlException ) |
| 5 | subExceptionDef( FileException ) | 5 | subExceptionDef( FileException ) |
| 6 | subExceptionDef( ConnectionException ) | 6 | subExceptionDef( ConnectionException ) |
| 7 | subExceptionDef( PluginException ) | ||
| 8 | |||
diff --git a/src/exceptions.h b/src/exceptions.h index cf9d47a..0ab2b15 100644 --- a/src/exceptions.h +++ b/src/exceptions.h | |||
| @@ -7,6 +7,7 @@ | |||
| 7 | subExceptionDecl( XmlException ) | 7 | subExceptionDecl( XmlException ) |
| 8 | subExceptionDecl( FileException ) | 8 | subExceptionDecl( FileException ) |
| 9 | subExceptionDecl( ConnectionException ) | 9 | subExceptionDecl( ConnectionException ) |
| 10 | subExceptionDecl( PluginException ) | ||
| 10 | 11 | ||
| 11 | enum eFileException | 12 | enum eFileException |
| 12 | { | 13 | { |
diff --git a/src/plugger.h b/src/plugger.h index b531fae..ee7594a 100644 --- a/src/plugger.h +++ b/src/plugger.h | |||
| @@ -6,6 +6,7 @@ | |||
| 6 | #include "hashfunctionstring.h" | 6 | #include "hashfunctionstring.h" |
| 7 | #include "hashfunctionint.h" | 7 | #include "hashfunctionint.h" |
| 8 | #include "dlfcn.h" | 8 | #include "dlfcn.h" |
| 9 | #include "exceptions.h" | ||
| 9 | 10 | ||
| 10 | typedef struct PluginInfo | 11 | typedef struct PluginInfo |
| 11 | { | 12 | { |
| @@ -130,14 +131,12 @@ public: | |||
| 130 | pReg->dlHandle = dlopen( sFName, RTLD_NOW ); | 131 | pReg->dlHandle = dlopen( sFName, RTLD_NOW ); |
| 131 | if( pReg->dlHandle == NULL ) | 132 | if( pReg->dlHandle == NULL ) |
| 132 | { | 133 | { |
| 133 | printf("***ERROR: %s\n\n", dlerror() ); | 134 | throw PluginException( 1, "Error on %s: %s", sFName, dlerror() ); |
| 134 | exit( 105 ); | ||
| 135 | } | 135 | } |
| 136 | pReg->pInfo = (PluginInfo *)dlsym( pReg->dlHandle, sPluginName ); | 136 | pReg->pInfo = (PluginInfo *)dlsym( pReg->dlHandle, sPluginName ); |
| 137 | if( pReg->pInfo == NULL ) | 137 | if( pReg->pInfo == NULL ) |
| 138 | { | 138 | { |
| 139 | printf("***ERROR: %s\n\n", dlerror() ); | 139 | throw PluginException( 2, "Error on %s: %s", sFName, dlerror() ); |
| 140 | exit( 106 ); | ||
| 141 | } | 140 | } |
| 142 | hPlugin.insert( pReg->pInfo->sID, pReg ); | 141 | hPlugin.insert( pReg->pInfo->sID, pReg ); |
| 143 | lPlugin.insert( lPlugin.end(), pReg ); | 142 | lPlugin.insert( lPlugin.end(), pReg ); |
