errors 0.6.3
Loading...
Searching...
No Matches
error_with_cause.hpp
1#pragma once
2
3#include "errors/error.hpp"
4#include "errors/error_ptr.hpp"
5#include "errors/impl/base_error.hpp"
6
7namespace errors
8{
9namespace impl
10{
11
20 public:
30 : base_error(std::move(loc))
31 , cause_(std::move(cause))
32 {
33 }
34
35 const error_ptr &cause() const & noexcept override
36 {
37 return this->cause_;
38 }
39
40 error_ptr cause() && noexcept override
41 {
42 return std::move(this->cause_);
43 }
44
45 private:
46 error_ptr cause_;
47};
48static_assert(std::is_abstract<error_with_cause>());
49
50}
51}
Smart pointer to errors::error with some utility member functions.
Definition error_ptr.hpp:13
A base error class.
Definition base_error.hpp:16
A base error class.
Definition error_with_cause.hpp:19
error_ptr cause() &&noexcept override
Transfer the ownership of cause of this error, if any.
Definition error_with_cause.hpp:40
const error_ptr & cause() const &noexcept override
Get cause of this error, if any.
Definition error_with_cause.hpp:35
error_with_cause(error_ptr &&cause, source_location loc)
Constructor with source_location.
Definition error_with_cause.hpp:29
The source location.
Definition source_location.hpp:46