userver: userver/chaotic/exception.hpp Source File
Loading...
Searching...
No Matches
exception.hpp
1#pragma once
2
3#include <stdexcept>
4
5#include <fmt/format.h>
6
7#include <userver/formats/json/value.hpp>
8
9USERVER_NAMESPACE_BEGIN
10
11namespace chaotic {
12
13class Error final : public formats::json::Exception {
14 using Exception::Exception;
15};
16
17template <typename Value>
18[[noreturn]] inline void ThrowForValue(std::string_view str, Value value) {
19 throw Error(fmt::format("Error at path '{}': {}", value.GetPath(), str));
20}
21
22} // namespace chaotic
23
24USERVER_NAMESPACE_END