userver
C++ Async Framework
Toggle main menu visibility
Loading...
Searching...
No Matches
json_error_builder.hpp
Go to the documentation of this file.
1
#pragma once
2
5
6
#include <
userver/formats/json/value.hpp
>
7
#include <
userver/http/content_type.hpp
>
8
9
#include <
userver/server/handlers/exceptions.hpp
>
10
11
USERVER_NAMESPACE_BEGIN
12
13
namespace
server::handlers
{
14
17
class
JsonErrorBuilder {
18
public
:
19
static
constexpr
bool
kIsExternalBodyFormatted =
true
;
20
21
explicit
JsonErrorBuilder(
const
CustomHandlerException
& ex);
22
23
JsonErrorBuilder(
24
std::string_view error_code,
25
std::string internal_message,
26
std::string_view external_error_body,
27
formats::json::Value
= {}
28
);
29
30
const
std::string& GetInternalMessage()
const
{
return
internal_message_; };
31
32
const
std::string& GetExternalBody()
const
{
return
json_error_body_; }
33
34
static
const
USERVER_NAMESPACE::http::ContentType& GetContentType() {
35
return
USERVER_NAMESPACE::http::content_type::kApplicationJson;
36
}
37
38
private
:
39
std::string internal_message_;
40
std::string json_error_body_;
41
};
42
43
}
// namespace server::handlers
44
45
USERVER_NAMESPACE_END
userver
server
handlers
json_error_builder.hpp
Generated on
for userver by
Doxygen
1.17.0