3m/3mExceptions.cpp

43 lines
786 B
C++

#include "3mExceptions.h"
using namespace mmm;
FileException::FileException(std::string filename, std::string mode, std::string err) {
_filename = filename;
_mode = mode;
_err = err;
}
FileException::~FileException() throw() {
_filename = "";
_mode = "";
_err = "";
}
const char* FileException::what() const throw() {
std::string msg = "";
msg += _filename;
msg += " (";
msg += _mode;
msg += "): ";
msg += _err;
return msg.c_str();
}
ParseException::ParseException(std::string filename, std::string err) {
_filename = filename;
_err = err;
}
ParseException::~ParseException() throw() {
_filename = "";
_err = "";
}
const char* ParseException::what() const throw() {
std::string msg = "";
msg += _filename;
msg += ": ";
msg += _err;
return msg.c_str();
}