3#include <userver/engine/deadline.hpp>
4#include <userver/engine/sleep.hpp>
5#include <userver/error_injection/settings.hpp>
6#include <userver/logging/log.hpp>
7#include <userver/tracing/span.hpp>
18 explicit Hook(
const Settings& settings, engine::Deadline deadline);
24 template <
typename TimeoutException,
typename ErrorException>
33 LOG_ERROR() <<
"Error injection hook triggered verdict: error";
34 throw ErrorException{
"error injection"};
37 LOG_ERROR() <<
"Error injection hook triggered verdict: timeout";
40 "error_injection_timeout");
41 engine::InterruptibleSleepUntil(deadline_);
43 throw TimeoutException{
"error injection"};
61 engine::Deadline deadline = CalcPostHookDeadline();
65 <<
"Error injection hook triggered verdict: max-delay / random-delay";
68 engine::InterruptibleSleepUntil(deadline);
72 engine::Deadline CalcPostHookDeadline();
74 static Verdict ReturnVerdict(
const Settings& settings);
77 const engine::Deadline deadline_;