29 lines
754 B
C++
29 lines
754 B
C++
|
#include <bolt/Errors.hpp>
|
||
|
|
||
|
namespace lightningbolt {
|
||
|
|
||
|
namespace {
|
||
|
struct BoltErrorCategory : std::error_category {
|
||
|
const char* name() const noexcept override { return "bolt"; }
|
||
|
std::string message(i32 ev) const override {
|
||
|
switch(static_cast<BoltErrc>(ev)) {
|
||
|
case BoltErrc::InvalidMagic: return "Invalid bolt library file magic";
|
||
|
case BoltErrc::DecompressionError: return "Error during BOLT file decompression";
|
||
|
default: return "Unknown error";
|
||
|
}
|
||
|
}
|
||
|
};
|
||
|
|
||
|
} // namespace
|
||
|
|
||
|
const BoltErrorCategory boltCategory {};
|
||
|
|
||
|
} // namespace lightningbolt
|
||
|
|
||
|
namespace std {
|
||
|
std::error_code make_error_code(::lightningbolt::BoltErrc errc) {
|
||
|
return { static_cast<i32>(errc), ::lightningbolt::boltCategory };
|
||
|
}
|
||
|
|
||
|
} // namespace std
|