59 lines
889 B
C++
59 lines
889 B
C++
#include <cstring>
|
|
#include <cerrno>
|
|
|
|
#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_);
|
|
}
|