69 lines
1.3 KiB
C++
69 lines
1.3 KiB
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();
|
|
}
|
|
|
|
BadResponseException::BadResponseException(std::string response) {
|
|
_response = response;
|
|
}
|
|
|
|
BadResponseException::~BadResponseException() throw() {
|
|
_response = "";
|
|
}
|
|
|
|
const char* BadResponseException::what() const throw() {
|
|
std::string what = "Got HTTP response: ";
|
|
what += _response;
|
|
return what.c_str();
|
|
}
|
|
|
|
NonEditableException::NonEditableException(std::string what) {
|
|
_what = what;
|
|
}
|
|
|
|
NonEditableException::~NonEditableException() throw() {
|
|
_what = "";
|
|
}
|
|
|
|
const char* NonEditableException::what() const throw() {
|
|
return _what.c_str();
|
|
}
|