#include "modules.h"
#include "helperfuncs.h"
+class FilterPCREException : public ModuleException
+{
+ public:
+ virtual const char* GetReason()
+ {
+ return "Could not find <filter file=\"\"> definition in your config file!";
+ }
+};
+
/* $ModDesc: m_filter with regexps */
/* $CompileFlags: -I/usr/local/include */
/* $LinkerFlags: -L/usr/local/lib -lpcre */
MyConf = new ConfigReader(filterfile);
if ((filterfile == "") || (!MyConf->Verify()))
{
- printf("Error, could not find <filter file=\"\"> definition in your config file!\n");
- log(DEFAULT,"Error, could not find <filter file=\"\"> definition in your config file!");
- return;
+ FilterPCREException e;
+ throw(e);
}
Srv->Log(DEFAULT,std::string("m_filter_pcre: read configuration from ")+filterfile);
return 0;
}
- virtual void OnRehash(std::string parameter)
+ virtual void OnRehash(const std::string ¶meter)
{
// reload our config file on rehash - we must destroy and re-allocate the classes
// to call the constructor again and re-read our data.
MyConf = new ConfigReader(filterfile);
if ((filterfile == "") || (!MyConf->Verify()))
{
+ FilterPCREException e;
// bail if the user forgot to create a config file
- printf("Error, could not find <filter file=\"\"> definition in your config file!");
- log(DEFAULT,"Error, could not find <filter file=\"\"> definition in your config file!");
- return;
+ throw(e);
}
Srv->Log(DEFAULT,std::string("m_filter_pcre: read configuration from ")+filterfile);