blob: 0b65b860012996099441b72eb6008d98effc3a2c (
plain) (
blame)
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
/*
* This source code is released into the public domain.
*/
module;
#include <string>
#include <system_error>
module nihil.ucl;
namespace nihil::ucl {
struct ucl_error_category final : std::error_category {
auto name() const noexcept -> char const * override;
auto message(int err) const -> std::string override;
};
auto ucl_category() noexcept -> std::error_category &
{
static auto category = ucl_error_category();
return category;
}
auto make_error_condition(errc ec) -> std::error_condition
{
return {static_cast<int>(ec), ucl_category()};
}
auto ucl_error_category::name() const noexcept -> char const *
{
return "nihil.ucl";
}
auto ucl_error_category::message(int err) const -> std::string
{
switch (static_cast<errc>(err)) {
case errc::no_error:
return "No error";
case errc::failed_to_create_object:
return "Failed to create UCL object";
case errc::type_mismatch:
return "UCL type does not match expected type";
default:
return "Undefined error";
}
}
} // namespace nihil::ucl
|