This commit is contained in:
28
deps/ox/src/ox/std/error.hpp
vendored
28
deps/ox/src/ox/std/error.hpp
vendored
@ -26,6 +26,7 @@ class exception {
|
||||
|
||||
#include "defines.hpp"
|
||||
#include "def.hpp"
|
||||
#include "source_location.hpp"
|
||||
#include "typetraits.hpp"
|
||||
#include "utility.hpp"
|
||||
|
||||
@ -45,16 +46,35 @@ struct [[nodiscard]] Error {
|
||||
|
||||
constexpr Error() noexcept = default;
|
||||
|
||||
explicit constexpr Error(ErrorCode ec) noexcept: errCode(ec) {
|
||||
}
|
||||
|
||||
explicit constexpr Error(const char *file, uint32_t line, ErrorCode errCode, const char *msg = nullptr) noexcept {
|
||||
explicit constexpr Error(
|
||||
const char *file,
|
||||
uint32_t const line,
|
||||
ErrorCode const errCode,
|
||||
const char *msg = nullptr) noexcept {
|
||||
this->file = file;
|
||||
this->line = static_cast<uint16_t>(line);
|
||||
this->msg = msg;
|
||||
this->errCode = errCode;
|
||||
}
|
||||
|
||||
explicit constexpr Error(
|
||||
ErrorCode const errCode,
|
||||
std::source_location const&src = std::source_location::current()) noexcept {
|
||||
this->file = src.file_name();
|
||||
this->line = static_cast<uint16_t>(src.line());
|
||||
this->errCode = errCode;
|
||||
}
|
||||
|
||||
explicit constexpr Error(
|
||||
ErrorCode const errCode,
|
||||
const char *msg,
|
||||
std::source_location const&src = std::source_location::current()) noexcept {
|
||||
this->file = src.file_name();
|
||||
this->line = static_cast<uint16_t>(src.line());
|
||||
this->msg = msg;
|
||||
this->errCode = errCode;
|
||||
}
|
||||
|
||||
constexpr Error(const Error &o) noexcept {
|
||||
this->msg = o.msg;
|
||||
this->file = o.file;
|
||||
|
Reference in New Issue
Block a user