xrpld
Loading...
Searching...
No Matches
include
xrpl
protocol
detail
token_errors.h
1
#pragma once
2
3
#include <
system_error
>
4
5
namespace
xrpl
{
6
enum class
TokenCodecErrc
{
7
Success
= 0,
8
InputTooLarge
,
9
InputTooSmall
,
10
BadB58Character
,
11
OutputTooSmall
,
12
MismatchedTokenType
,
13
MismatchedChecksum
,
14
InvalidEncodingChar
,
15
OverflowAdd
,
16
Unknown
,
17
};
18
}
// namespace xrpl
19
20
namespace
std
{
21
template
<>
22
struct
is_error_code_enum
<
xrpl
::TokenCodecErrc> :
true_type
23
{
24
};
25
}
// namespace std
26
27
namespace
xrpl
{
28
namespace
detail {
29
class
TokenCodecErrcCategory
:
public
std::error_category
30
{
31
public
:
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
{
44
case
TokenCodecErrc::Success
:
45
return
"conversion successful"
;
46
case
TokenCodecErrc::InputTooLarge
:
47
return
"input too large"
;
48
case
TokenCodecErrc::InputTooSmall
:
49
return
"input too small"
;
50
case
TokenCodecErrc::BadB58Character
:
51
return
"bad base 58 character"
;
52
case
TokenCodecErrc::OutputTooSmall
:
53
return
"output too small"
;
54
case
TokenCodecErrc::MismatchedTokenType
:
55
return
"mismatched token type"
;
56
case
TokenCodecErrc::MismatchedChecksum
:
57
return
"mismatched checksum"
;
58
case
TokenCodecErrc::InvalidEncodingChar
:
59
return
"invalid encoding char"
;
60
case
TokenCodecErrc::Unknown
:
61
default
:
62
return
"unknown"
;
63
}
64
}
65
};
66
}
// namespace detail
67
68
inline
xrpl::detail::TokenCodecErrcCategory
const
&
69
tokenCodecErrcCategory
()
70
{
71
static
xrpl::detail::TokenCodecErrcCategory
const
kC;
72
return
kC;
73
}
74
75
inline
std::error_code
76
make_error_code
(
xrpl::TokenCodecErrc
e)
77
{
78
return
{
static_cast<
int
>
(e),
tokenCodecErrcCategory
()};
79
}
80
}
// namespace xrpl
std::string
xrpl::detail::TokenCodecErrcCategory
Definition
token_errors.h:30
xrpl::detail::TokenCodecErrcCategory::message
std::string message(int c) const final
Definition
token_errors.h:40
xrpl::detail::TokenCodecErrcCategory::name
char const * name() const noexcept final
Definition
token_errors.h:34
std::error_category
std::error_code
std::true_type
std::is_error_code_enum
std
STL namespace.
xrpl
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition
algorithm.h:5
xrpl::make_error_code
std::error_code make_error_code(xrpl::TokenCodecErrc e)
Definition
token_errors.h:76
xrpl::NodeObjectType::Unknown
@ Unknown
Definition
NodeObject.h:13
xrpl::tokenCodecErrcCategory
xrpl::detail::TokenCodecErrcCategory const & tokenCodecErrcCategory()
Definition
token_errors.h:69
xrpl::TokenCodecErrc
TokenCodecErrc
Definition
token_errors.h:6
xrpl::TokenCodecErrc::InputTooSmall
@ InputTooSmall
Definition
token_errors.h:9
xrpl::TokenCodecErrc::InputTooLarge
@ InputTooLarge
Definition
token_errors.h:8
xrpl::TokenCodecErrc::Success
@ Success
Definition
token_errors.h:7
xrpl::TokenCodecErrc::BadB58Character
@ BadB58Character
Definition
token_errors.h:10
xrpl::TokenCodecErrc::InvalidEncodingChar
@ InvalidEncodingChar
Definition
token_errors.h:14
xrpl::TokenCodecErrc::Unknown
@ Unknown
Definition
token_errors.h:16
xrpl::TokenCodecErrc::MismatchedChecksum
@ MismatchedChecksum
Definition
token_errors.h:13
xrpl::TokenCodecErrc::OverflowAdd
@ OverflowAdd
Definition
token_errors.h:15
xrpl::TokenCodecErrc::MismatchedTokenType
@ MismatchedTokenType
Definition
token_errors.h:12
xrpl::TokenCodecErrc::OutputTooSmall
@ OutputTooSmall
Definition
token_errors.h:11
system_error
Generated by
1.16.1