rippled
Loading...
Searching...
No Matches
token_errors.h
1#pragma once
2
3#include <system_error>
4
5namespace xrpl {
18}
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 virtual char const*
34 name() const noexcept override final
35 {
36 return "TokenCodecError";
37 }
38 // Return what each enum means in text
39 virtual std::string
40 message(int c) const override 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 return "unknown";
62 default:
63 return "unknown";
64 }
65 }
66};
67} // namespace detail
68
75
76inline std::error_code
78{
79 return {static_cast<int>(e), TokenCodecErrcCategory()};
80}
81} // namespace xrpl
virtual char const * name() const noexcept override final
virtual std::string message(int c) const override 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