This repository has been archived on 2021-06-27. You can view files and clone it, but cannot push or open issues or pull requests.
modetw/src/exceptionhandler.cpp

28 lines
777 B
C++

#include "../include/exceptionhandler.hpp"
ExceptionHandler::ExceptionHandler(const ErrorCode e, const std::string &s)
: _e(e), _s(s) {}
ExceptionHandler::ExceptionHandler(const ErrorCode e)
: _e(e) {}
void ExceptionHandler::GrabError()
{
std::string str;
std::cerr << "Error code " << _e << "!" << "\n";
switch (_e)
{
case CUSTOM_ERROR: str += _s; break;
case INVALID_PATH_ERROR: str += "\"" + _s + "\" is an invalid path."; break;
case INVALID_ARGUMENT_ERROR: str += "\"" + _s + "\" is an invalid argument."; break;
case NO_ARGUMENT_ERROR: str += "No arguments found."; break;
case PROCESS_ERROR: str += "Failed to process " + _s; break;
case UNKNOWN_ERROR:
default: str += "Unknown error."; break;
}
std::cerr << str << "\n";
}