2011-09-09 20:40:59 +02:00
|
|
|
#ifndef exception_hh_INCLUDED
|
|
|
|
#define exception_hh_INCLUDED
|
|
|
|
|
2012-04-14 03:17:09 +02:00
|
|
|
#include "string.hh"
|
2011-09-09 20:40:59 +02:00
|
|
|
|
|
|
|
namespace Kakoune
|
|
|
|
{
|
|
|
|
|
|
|
|
struct exception
|
|
|
|
{
|
|
|
|
virtual ~exception() {}
|
2013-04-11 13:57:35 +02:00
|
|
|
virtual const char* what() const;
|
2011-09-09 20:40:59 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
struct runtime_error : exception
|
|
|
|
{
|
2013-04-11 13:57:35 +02:00
|
|
|
runtime_error(String what)
|
|
|
|
: m_what(std::move(what)) {}
|
2011-09-09 20:40:59 +02:00
|
|
|
|
2013-04-11 13:57:35 +02:00
|
|
|
const char* what() const override { return m_what.c_str(); }
|
2011-09-09 20:40:59 +02:00
|
|
|
|
|
|
|
private:
|
2013-04-11 13:57:35 +02:00
|
|
|
String m_what;
|
2011-09-09 20:40:59 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
struct logic_error : exception
|
|
|
|
{
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // exception_hh_INCLUDED
|