From e82431fb4f5155220c8c0d3f7d11c6d60ab475a4 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Tue, 30 Jan 2007 22:40:07 +0000 Subject: Hey, Plugger doesn't kill your program with exit, it just throws an exception. --- src/exceptions.cpp | 2 ++ src/exceptions.h | 1 + src/plugger.h | 7 +++---- 3 files changed, 6 insertions(+), 4 deletions(-) (limited to 'src') 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 @@ subExceptionDef( XmlException ) subExceptionDef( FileException ) subExceptionDef( ConnectionException ) +subExceptionDef( PluginException ) + 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 @@ subExceptionDecl( XmlException ) subExceptionDecl( FileException ) subExceptionDecl( ConnectionException ) +subExceptionDecl( PluginException ) enum eFileException { 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 @@ #include "hashfunctionstring.h" #include "hashfunctionint.h" #include "dlfcn.h" +#include "exceptions.h" typedef struct PluginInfo { @@ -130,14 +131,12 @@ public: pReg->dlHandle = dlopen( sFName, RTLD_NOW ); if( pReg->dlHandle == NULL ) { - printf("***ERROR: %s\n\n", dlerror() ); - exit( 105 ); + throw PluginException( 1, "Error on %s: %s", sFName, dlerror() ); } pReg->pInfo = (PluginInfo *)dlsym( pReg->dlHandle, sPluginName ); if( pReg->pInfo == NULL ) { - printf("***ERROR: %s\n\n", dlerror() ); - exit( 106 ); + throw PluginException( 2, "Error on %s: %s", sFName, dlerror() ); } hPlugin.insert( pReg->pInfo->sID, pReg ); lPlugin.insert( lPlugin.end(), pReg ); -- cgit v1.2.3