errors.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#include "crucible/os/errors.hpp" namespace crucible::os::errors { #ifdef CRUCIBLE_UNIX OsError::OsError(unix::errors::UnixError const &error) : my_error { error } { } #endif // CRUCIBLE_UNIX #ifdef CRUCIBLE_WINDOWS OsError::OsError(windows::errors::WindowsError const &error) : my_error { error } { } #endif // CRUCIBLE_WINDOWS OsError::~OsError() = default; auto OsError::describe() const -> std::string { return my_error.describe(); } auto OsError::format() const -> std::string { return "OsError { " + my_error.format() + " }"; } auto OsError::source() const & -> std::optional<std::reference_wrapper<core::errors::AbstractError const>> { return std::cref<core::errors::AbstractError>(my_error); } }