#include #include #include "exceptions.hh" using namespace std::string_literals; Exception::Exception(std::string msg) : msg_(std::move(msg)) { } Exception::~Exception() { } std::string Exception::toString() const { return "Exception: " + msg_; } FormatException::FormatException(std::string msg) : Exception(std::move(msg)) { } std::string FormatException::toString() const { return "FormatException: " + msg_; } PathException::PathException(std::string msg) : Exception(std::move(msg)) { } std::string PathException::toString() const { return "PathException: " + msg_; } POSIXException::POSIXException(int err, std::string msg) : Exception(std::move(msg)), err_(err) { } int POSIXException::getErr() const { return err_; } std::string POSIXException::toString() const { return "POSIXException: " + msg_ + ": " + std::strerror(err_); }