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 engine::InterruptibleSleepUntil(deadline_);
42 throw TimeoutException{
"error injection"};
60 engine::Deadline deadline = CalcPostHookDeadline();
63 LOG_ERROR() <<
"Error injection hook triggered verdict: max-delay / random-delay";
65 engine::InterruptibleSleepUntil(deadline);
69 engine::Deadline CalcPostHookDeadline();
71 static Verdict ReturnVerdict(
const Settings& settings);
74 const engine::Deadline deadline_;