userver
C++ Async Framework
Toggle main menu visibility
Loading...
Searching...
No Matches
legacy_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
#include <
userver/server/http/http_status.hpp
>
11
12
USERVER_NAMESPACE_BEGIN
13
14
namespace
server::handlers
{
15
18
class
LegacyJsonErrorBuilder {
19
public
:
20
static
constexpr
bool
kIsExternalBodyFormatted =
true
;
21
22
explicit
LegacyJsonErrorBuilder(
const
CustomHandlerException
& ex);
23
24
LegacyJsonErrorBuilder(
http::HttpStatus
status, std::string internal_message, std::string external_error_body);
25
26
LegacyJsonErrorBuilder(
27
http::HttpStatus
status,
28
std::string internal_message,
29
std::string external_error_body,
30
const
formats::json::Value
& details
31
);
32
33
const
std::string& GetInternalMessage()
const
{
return
internal_message_; };
34
35
const
std::string& GetExternalBody()
const
{
return
json_error_body_; }
36
37
static
const
USERVER_NAMESPACE::http::ContentType& GetContentType() {
38
return
USERVER_NAMESPACE::http::content_type::kApplicationJson;
39
}
40
41
private
:
42
std::string internal_message_;
43
std::string json_error_body_;
44
};
45
46
}
// namespace server::handlers
47
48
USERVER_NAMESPACE_END
userver
server
handlers
legacy_json_error_builder.hpp
Generated on
for userver by
Doxygen
1.17.0