Commit 59f117d3 authored by Dominik Charousset's avatar Dominik Charousset

Add make_error for parser error code

parent 648112ae
......@@ -20,6 +20,8 @@
#include <cstdint>
#include "caf/fwd.hpp"
namespace caf {
namespace detail {
namespace parser {
......@@ -53,6 +55,8 @@ enum class ec : uint8_t {
exponent_overflow,
};
error make_error(ec code);
const char* to_string(ec x);
} // namespace parser
......
......@@ -18,6 +18,8 @@
#include "caf/detail/parser/ec.hpp"
#include "caf/error.hpp"
namespace {
constexpr const char* tbl[] = {
......@@ -42,6 +44,10 @@ namespace caf {
namespace detail {
namespace parser {
error make_error(ec code) {
return {static_cast<uint8_t>(code), atom("parser")};
}
const char* to_string(ec x) {
return tbl[static_cast<uint8_t>(x)];
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment