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