errors 0.6.3
Loading...
Searching...
No Matches
wrap.hpp
1
2#include <memory>
3
4#include "errors/impl/wrap_error.hpp"
5#include "errors/make.hpp"
6#include "errors/source_location.hpp"
7
8namespace errors
9{
10
14class wrap : public error_ptr {
15 public:
25 wrap(std::string message, error_ptr &&cause,
27 : error_ptr(
28 cause != nullptr ?
29 static_cast<error_ptr>(
30 detail::make<impl::wrap_error>::with(
31 std::move(message),
32 std::move(cause),
33 std::move(location))) :
34 nullptr)
35 {
36 }
37
40 wrap(error_ptr &&cause,
42 : error_ptr(
43 cause != nullptr ?
44 static_cast<error_ptr>(
45 detail::make<impl::wrap_error>::with(
46 std::move(cause),
47 std::move(location))) :
48 nullptr)
49 {
50 }
51};
52}
Smart pointer to errors::error with some utility member functions.
Definition error_ptr.hpp:13
Definition make.hpp:42
A function like class to wrap an error.
Definition wrap.hpp:14
wrap(error_ptr &&cause, source_location location=source_location::current())
Wraps an error.
Definition wrap.hpp:40
wrap(std::string message, error_ptr &&cause, source_location location=source_location::current())
Wraps an error with an optional message.
Definition wrap.hpp:25
The source location.
Definition source_location.hpp:46
static constexpr source_location current(const char *fileName="unsupported", const char *functionName="unsupported", const uint_least32_t lineNumber=0, const uint_least32_t columnOffset=0) noexcept
Returns the current source location.
Definition source_location.hpp:70