xrpld
Loading...
Searching...
No Matches
token_errors.h
1#pragma once
2
3#include <string>
4#include <system_error>
5#include <type_traits>
6
7namespace xrpl {
20} // namespace xrpl
21
22namespace std {
23template <>
24struct is_error_code_enum<xrpl::TokenCodecErrc> : true_type
25{
26};
27} // namespace std
28
29namespace xrpl {
30namespace detail {
32{
33public:
34 // Return a short descriptive name for the category
35 [[nodiscard]] char const*
36 name() const noexcept final
37 {
38 return "TokenCodecError";
39 }
40 // Return what each enum means in text
41 [[nodiscard]] std::string
42 message(int c) const final
43 {
44 switch (static_cast<TokenCodecErrc>(c))
45 {
47 return "conversion successful";
49 return "input too large";
51 return "input too small";
53 return "bad base 58 character";
55 return "output too small";
57 return "mismatched token type";
59 return "mismatched checksum";
61 return "invalid encoding char";
63 default:
64 return "unknown";
65 }
66 }
67};
68} // namespace detail
69
72{
74 return kC;
75}
76
77inline std::error_code
79{
80 return {static_cast<int>(e), tokenCodecErrcCategory()};
81}
82} // namespace xrpl
std::string message(int c) const final
char const * name() const noexcept final
STL namespace.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:5
std::error_code make_error_code(xrpl::TokenCodecErrc e)
xrpl::detail::TokenCodecErrcCategory const & tokenCodecErrcCategory()
TokenCodecErrc
Definition token_errors.h:8