rippled
Loading...
Searching...
No Matches
token_errors.h
1#ifndef XRPL_PROTOCOL_TOKEN_ERRORS_H_INCLUDED
2#define XRPL_PROTOCOL_TOKEN_ERRORS_H_INCLUDED
3
4#include <system_error>
5
6namespace ripple {
19}
20
21namespace std {
22template <>
23struct is_error_code_enum<ripple::TokenCodecErrc> : true_type
24{
25};
26} // namespace std
27
28namespace ripple {
29namespace detail {
31{
32public:
33 // Return a short descriptive name for the category
34 virtual char const*
35 name() const noexcept override final
36 {
37 return "TokenCodecError";
38 }
39 // Return what each enum means in text
40 virtual std::string
41 message(int c) const override final
42 {
43 switch (static_cast<TokenCodecErrc>(c))
44 {
46 return "conversion successful";
48 return "input too large";
50 return "input too small";
52 return "bad base 58 character";
54 return "output too small";
56 return "mismatched token type";
58 return "mismatched checksum";
60 return "invalid encoding char";
62 return "unknown";
63 default:
64 return "unknown";
65 }
66 }
67};
68} // namespace detail
69
76
77inline std::error_code
79{
80 return {static_cast<int>(e), TokenCodecErrcCategory()};
81}
82} // namespace ripple
83#endif // TOKEN_ERRORS_H_
virtual char const * name() const noexcept override final
virtual std::string message(int c) const override final
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:6
std::error_code make_error_code(ripple::TokenCodecErrc e)
ripple::detail::TokenCodecErrcCategory const & TokenCodecErrcCategory()
STL namespace.