xrpld
Loading...
Searching...
No Matches
token_errors.h
1#pragma once
2
3#include <system_error>
4
5namespace xrpl {
18} // namespace xrpl
19
20namespace std {
21template <>
22struct is_error_code_enum<xrpl::TokenCodecErrc> : true_type
23{
24};
25} // namespace std
26
27namespace xrpl {
28namespace detail {
30{
31public:
32 // Return a short descriptive name for the category
33 [[nodiscard]] char const*
34 name() const noexcept final
35 {
36 return "TokenCodecError";
37 }
38 // Return what each enum means in text
39 [[nodiscard]] std::string
40 message(int c) const final
41 {
42 switch (static_cast<TokenCodecErrc>(c))
43 {
45 return "conversion successful";
47 return "input too large";
49 return "input too small";
51 return "bad base 58 character";
53 return "output too small";
55 return "mismatched token type";
57 return "mismatched checksum";
59 return "invalid encoding char";
61 default:
62 return "unknown";
63 }
64 }
65};
66} // namespace detail
67
70{
72 return kC;
73}
74
75inline std::error_code
77{
78 return {static_cast<int>(e), tokenCodecErrcCategory()};
79}
80} // 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:6