errors 0.6.3
Loading...
Searching...
No Matches
runtime_error.hpp
1#pragma once
2
3#include <string>
4
5#include "errors/impl/error_without_cause.hpp"
6
7namespace errors
8{
9
10namespace impl
11{
12
19 public:
28 runtime_error(std::string msg, source_location loc)
29 : error_without_cause(std::move(loc))
30 , message(std::move(msg))
31 {
32 }
33
34 const char *what() const noexcept override
35 {
36 return this->message.c_str();
37 }
38
41 std::string message;
42};
43static_assert(!std::is_abstract<runtime_error>());
44
45}
46}
A base error class.
Definition error_without_cause.hpp:18
An error that has a message.
Definition runtime_error.hpp:18
std::string message
The error message.
Definition runtime_error.hpp:41
runtime_error(std::string msg, source_location loc)
Constructor with message and source_location.
Definition runtime_error.hpp:28
const char * what() const noexcept override
Get error message.
Definition runtime_error.hpp:34
The source location.
Definition source_location.hpp:46