4#ifndef GREM_CORE_ERROR_HPP
5#define GREM_CORE_ERROR_HPP
22struct FilepathError : std::exception {
25 explicit FilepathError(
String filepath)
26 : filepath(std::
move(filepath)) {}
28 [[nodiscard]]
const char* what() const noexcept
override {
29 return filepath.c_str();
38class Error :
public std::runtime_error {
40 template <
typename OuterException>
42 std::throw_with_nested(std::forward<OuterException>(error));
46 std::throw_with_nested(detail::FilepathError{std::move(filepath)});
50 std::throw_with_nested(detail::FilepathError{
String{filepath}});
56 : runtime_error(message.c_str()) {}
58 template <convertible_to<StringView> StringViewConvertible>
63 output.append(what());
static void throwWithNested(OuterException &&error)
Definition Error.hpp:41
virtual void writeMessage(String &output) const
Definition Error.hpp:62
virtual bool messageAttachesToPrecedingFilepath() const noexcept
Definition Error.hpp:66
static void throwWithNestedFilepath(String filepath)
Definition Error.hpp:45
static void throwWithNestedFilepath(CStringView filepath)
Definition Error.hpp:49
Error(CStringView message)
Definition Error.hpp:55
static String formatCurrentExceptionMessage()
Error(const StringViewConvertible &message)
Definition Error.hpp:59
Definition concepts.hpp:47
constexpr auto move(input_range auto &&range, auto outputIterator)
Definition algorithms.hpp:669
StringBase< char, std::char_traits< char >, std::allocator< char > > String
Definition String.hpp:17
StringViewBase< char, std::char_traits< char > > StringView
Definition StringView.hpp:16
CStringViewBase< char, std::char_traits< char > > CStringView
Definition CStringView.hpp:635