errors 0.6.3
Loading...
Searching...
No Matches
error.hpp
1#pragma once
2
3#include <optional>
4
5#include "errors/detail/interface.hpp"
6
7namespace errors
8{
9
10class error_ptr;
11struct source_location;
12
20class error : public virtual detail::interface {
21 public:
37 [[nodiscard]]
38 virtual const char *what() const noexcept = 0;
47 [[nodiscard]]
48 virtual const error_ptr &cause() const & noexcept = 0;
62 [[nodiscard]]
63 virtual error_ptr cause() && noexcept = 0;
75 [[nodiscard]]
76 virtual std::optional<source_location> location() const noexcept = 0;
77};
78static_assert(std::is_abstract<error>());
79}
This is the abstract class for all interface type. Disable copy and move operations.
Definition interface.hpp:15
Smart pointer to errors::error with some utility member functions.
Definition error_ptr.hpp:13
Interface representing an error.
Definition error.hpp:20
virtual const char * what() const noexcept=0
Get error message.
virtual std::optional< source_location > location() const noexcept=0
Get the source location of this error, if any.
virtual const error_ptr & cause() const &noexcept=0
Get cause of this error, if any.
The source location.
Definition source_location.hpp:46