patrick
/
plasp
Archived
1
0
Fork 0

Removed error message prefixes.

This commit is contained in:
Patrick Lühne 2016-06-14 15:06:43 +02:00
parent a6c9434590
commit 777c9839a1
3 changed files with 10 additions and 10 deletions

View File

@ -101,7 +101,7 @@ int main(int argc, char **argv)
if (language == plasp::Language::Type::Unknown)
{
plasp::utils::Logger logger;
logger.exception("error", "unknown input language");
logger.logError("unknown input language");
std::cout << std::endl;
printHelp();
return EXIT_FAILURE;
@ -132,25 +132,25 @@ int main(int argc, char **argv)
catch (const plasp::utils::ParserException &e)
{
plasp::utils::Logger logger;
logger.parserException(e.coordinate(), e.message());
logger.logError(e.coordinate(), e.message());
return EXIT_FAILURE;
}
catch (const plasp::utils::ParserWarning &e)
{
plasp::utils::Logger logger;
logger.parserException(e.coordinate(), e.message());
logger.logError(e.coordinate(), e.message());
return EXIT_FAILURE;
}
catch (const plasp::utils::TranslatorException &e)
{
plasp::utils::Logger logger;
logger.exception("translation error", e.what());
logger.logError(e.what());
return EXIT_FAILURE;
}
catch (const std::exception &e)
{
plasp::utils::Logger logger;
logger.exception("unexpected error", e.what());
logger.logError(e.what());
return EXIT_FAILURE;
}

View File

@ -38,8 +38,8 @@ class Logger
void setWarningLevel(WarningLevel warningLevel);
void exception(const std::string &errorType, const std::string &message);
void parserException(const Parser::Coordinate &coordinate, const std::string &message);
void logError(const std::string &message);
void logError(const Parser::Coordinate &coordinate, const std::string &message);
void parserWarning(const Parser &parser, const std::string &message);
private:

View File

@ -62,12 +62,12 @@ void Logger::setWarningLevel(WarningLevel warningLevel)
////////////////////////////////////////////////////////////////////////////////////////////////////
void Logger::exception(const std::string &errorType, const std::string &message)
void Logger::logError(const std::string &message)
{
if (isatty(STDERR_FILENO))
{
std::cerr
<< Format(Color::Red, FontWeight::Bold) << errorType << ":"
<< Format(Color::Red, FontWeight::Bold) << "error:"
<< ResetFormat() << " "
<< Format(Color::White, FontWeight::Bold) << message
<< ResetFormat() << std::endl;
@ -84,7 +84,7 @@ void Logger::exception(const std::string &errorType, const std::string &message)
////////////////////////////////////////////////////////////////////////////////////////////////////
void Logger::parserException(const Parser::Coordinate &coordinate, const std::string &message)
void Logger::logError(const Parser::Coordinate &coordinate, const std::string &message)
{
if (isatty(STDERR_FILENO))
{