home/src/exception.hh
Maxime Coste 68fb3ba88f Rework fail command not to display command call stack
`fail` triggers "expected" errors, and hence should just display
the provided message.
2018-05-26 21:31:17 +10:00

39 lines
603 B
C++

#ifndef exception_hh_INCLUDED
#define exception_hh_INCLUDED
#include "string.hh"
namespace Kakoune
{
struct exception
{
virtual ~exception() = default;
virtual StringView what() const;
};
struct runtime_error : exception
{
runtime_error(String what)
: m_what(std::move(what)) {}
StringView what() const override { return m_what; }
void set_what(String what) { m_what = std::move(what); }
private:
String m_what;
};
struct failure : runtime_error
{
using runtime_error::runtime_error;
};
struct logic_error : exception
{
};
}
#endif // exception_hh_INCLUDED