userver
C++ Async Framework
Loading...
Searching...
No Matches
settings.hpp
Go to the documentation of this file.
1
#
pragma
once
2
3
/// @file userver/error_injection/settings.hpp
4
/// @brief Artificial error injection settings and verdict types
5
6
#
include
<
memory
>
7
#
include
<
string
>
8
#
include
<
vector
>
9
10
#
include
<
userver
/
yaml_config
/
yaml_config
.
hpp
>
11
12
USERVER_NAMESPACE_BEGIN
13
14
namespace
error_injection
{
15
16
/// What error injection hook may decide to do
17
enum
class
Verdict
{
18
kError
,
///< return error
19
kTimeout
,
///< wait for deadline and return error
20
kMaxDelay
,
///< wait for deadline w/o returning an error
21
kRandomDelay
,
///< wait for [0; deadline] w/o returning an error
22
23
// Skip must be the last
24
25
kSkip
,
///< no error
26
};
27
28
/// Artificial error injection settings
29
struct
Settings
final
{
30
/// error injection enabled
31
bool
enabled
{
false
};
32
33
/// error probability from range [0, 1]
34
double
probability
{0};
35
36
/// possible verdicts, will be chosen randomly, Verdict::Error if unspecified
37
std::vector<
Verdict
>
possible_verdicts
;
38
};
39
40
Settings Parse(
const
yaml_config::
YamlConfig
& value, formats::
parse
::To<Settings>);
41
42
}
// namespace error_injection
43
44
USERVER_NAMESPACE_END
userver
error_injection
settings.hpp
Generated on Thu May 21 2026 16:18:59 for userver by
Doxygen
1.13.2