kakoune/src/exception.hh

39 lines
603 B
C++
Raw Normal View History

2011-09-09 20:40:59 +02:00
#ifndef exception_hh_INCLUDED
#define exception_hh_INCLUDED
#include "string.hh"
2011-09-09 20:40:59 +02:00
namespace Kakoune
{
struct exception
{
virtual ~exception() = default;
virtual StringView what() const;
2011-09-09 20:40:59 +02:00
};
struct runtime_error : exception
{
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; }
void set_what(String what) { m_what = std::move(what); }
2011-09-09 20:40:59 +02:00
private:
String m_what;
2011-09-09 20:40:59 +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