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
|
|
|
|
{
|
2017-01-08 23:30:15 +01:00
|
|
|
virtual ~exception() = default;
|
2015-03-13 14:15:51 +01:00
|
|
|
virtual StringView 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
|
|
|
|
2015-03-25 14:34:00 +01:00
|
|
|
StringView what() const override { return m_what; }
|
2018-05-26 05:07:03 +02:00
|
|
|
void set_what(String what) { m_what = std::move(what); }
|
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
|
|
|
};
|
|
|
|
|
2018-05-26 05:07:03 +02:00
|
|
|
struct failure : runtime_error
|
|
|
|
{
|
|
|
|
using runtime_error::runtime_error;
|
|
|
|
};
|
|
|
|
|
2011-09-09 20:40:59 +02:00
|
|
|
struct logic_error : exception
|
|
|
|
{
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // exception_hh_INCLUDED
|