Newer
Older

Sylvester Joosten
committed
#ifndef UTIL_EXCEPTION
#define UTIL_EXCEPTION
#include <exception>
#include <string>

Sylvester Joosten
committed
class Exception : public std::exception {

Sylvester Joosten
committed
public:

Sylvester Joosten
committed
Exception(std::string_view msg, std::string_view type = "exception")

Sylvester Joosten
committed
: msg_{msg}, type_{type} {}
virtual const char* what() const throw() { return msg_.c_str(); }
virtual const char* type() const throw() { return type_.c_str(); }

Sylvester Joosten
committed
virtual ~Exception() throw() {}

Sylvester Joosten
committed
private:
std::string msg_;
std::string type_;
};