Improvements

Added new exception: 'BWlistException' for warnlists/blacklists.
Unleashed stdout print for the exceptions.
This commit is contained in:
Valentino Orlandi 2022-10-10 21:08:09 +02:00
parent 868913855e
commit f5a39ca3fa
Signed by: elB4RTO
GPG Key ID: 1719E976DB2D4E71
2 changed files with 31 additions and 5 deletions

View File

@ -9,7 +9,7 @@
GenericException::GenericException( const std::string& msg, const bool& to_sys )
{
if ( to_sys ) { // when sys, leave un-catched
//std::cout << "LogDoctor: Exception: " << msg << std::endl;
std::cout << "LogDoctor: Exception: " << msg << std::endl;
std::cerr << "LogDoctor: Exception: " << msg << std::endl;
} else {
this->msg = QString::fromStdString( msg );
@ -25,7 +25,7 @@ const QString& GenericException::what()
//// WEB SERVER ////
WebServerException::WebServerException(const std::string& msg ) // leave un-catched
{
//std::cout << "LogDoctor: WebServerException: " << msg << std::endl;
std::cout << "LogDoctor: WebServerException: " << msg << std::endl;
std::cerr << "LogDoctor: WebServerException: " << msg << std::endl;
/*this->msg = QString::fromStdString( msg );*/
}
@ -39,6 +39,8 @@ WebServerException::WebServerException(const std::string& msg ) // leave un-catc
//// LOG FORMAT ////
LogFormatException::LogFormatException(const std::string& msg )
{
std::cout << "LogDoctor: LogFormatException: " << msg << std::endl;
std::cerr << "LogDoctor: LogFormatException: " << msg << std::endl;
this->msg = QString::fromStdString( msg );
}
const QString& LogFormatException::what()
@ -49,9 +51,9 @@ const QString& LogFormatException::what()
////////////////////
//// LOG PARSER ////
LogParserException::LogParserException(const std::string& msg )
LogParserException::LogParserException(const std::string& msg ) // un-catched atm
{
//std::cout << "LogDoctor: LogParserException: " << msg << std::endl;
std::cout << "LogDoctor: LogParserException: " << msg << std::endl;
std::cerr << "LogDoctor: LogParserException: " << msg << std::endl;
/*this->msg = QString::fromStdString( msg );*/
}
@ -65,7 +67,7 @@ LogParserException::LogParserException(const std::string& msg )
//// DATE-TIME ////
DateTimeException::DateTimeException(const std::string& msg ) // leave un-catched
{
//std::cout << "LogDoctor: DateTimeException: " << msg << std::endl;
std::cout << "LogDoctor: DateTimeException: " << msg << std::endl;
std::cerr << "LogDoctor: DateTimeException: " << msg << std::endl;
/*this->msg = QString::fromStdString( msg );*/
}
@ -73,3 +75,17 @@ DateTimeException::DateTimeException(const std::string& msg ) // leave un-catche
{
return msg;
}*/
//////////////////////////
//// BLACK/WARN LISTS ////
BWlistException::BWlistException( const std::string& msg )
{
std::cout << "LogDoctor: BWlistException: " << msg << std::endl;
std::cerr << "LogDoctor: BWlistException: " << msg << std::endl;
/*this->msg = QString::fromStdString( msg );*/
}
/*const QString& DateTimeException::what()
{
return msg;
}*/

View File

@ -55,4 +55,14 @@ private:
QString msg;*/
};
class BWlistException : public std::exception {
public:
BWlistException( const std::string& msg );
/*const QString& what();
private:
QString msg;*/
};
#endif // EXCEPTIONS_H