userver
C++ Async Framework
Toggle main menu visibility
Loading...
Searching...
No Matches
exception.hpp
Go to the documentation of this file.
1
#pragma once
2
6
7
#include <iosfwd>
8
#include <stdexcept>
9
#include <string>
10
#include <string_view>
11
12
USERVER_NAMESPACE_BEGIN
13
14
namespace
formats::json
{
15
16
class
Exception :
public
std::exception {
17
public
:
18
explicit
Exception(std::string msg)
19
: msg_(std::move(msg))
20
{}
21
22
const
char
* what()
const
noexcept
final
;
23
24
std::string_view GetMessage()
const
noexcept
{
return
msg_; }
25
26
private
:
27
std::string msg_;
28
};
29
30
class
ParseException
:
public
Exception {
31
public
:
32
using
Exception::Exception;
33
~ParseException
()
override
;
34
};
35
36
class
ExceptionWithPath :
public
Exception {
37
public
:
38
explicit
ExceptionWithPath(std::string_view msg, std::string_view path);
39
40
std::string_view GetPath()
const
noexcept
;
41
std::string_view GetMessageWithoutPath()
const
noexcept
;
42
43
private
:
44
std::size_t path_size_;
45
};
46
47
class
BadStreamException :
public
Exception {
48
public
:
49
explicit
BadStreamException(
const
std::istream& is);
50
explicit
BadStreamException(
const
std::ostream& os);
51
};
52
53
class
TypeMismatchException :
public
ExceptionWithPath {
54
public
:
55
TypeMismatchException(
int
actual,
int
expected, std::string_view path);
56
std::string_view GetActual()
const
;
57
std::string_view GetExpected()
const
;
58
59
private
:
60
int
actual_;
61
int
expected_;
62
};
63
64
class
OutOfBoundsException :
public
ExceptionWithPath {
65
public
:
66
OutOfBoundsException(
size_t
index,
size_t
size, std::string_view path);
67
};
68
69
class
MemberMissingException :
public
ExceptionWithPath {
70
public
:
71
explicit
MemberMissingException(std::string_view path);
72
};
73
75
class
ConversionException :
public
ExceptionWithPath {
76
public
:
77
ConversionException(std::string_view msg, std::string_view path);
78
};
79
80
class
UnknownDiscriminatorException :
public
ExceptionWithPath {
81
public
:
82
UnknownDiscriminatorException(std::string_view path, std::string_view discriminator_field);
83
};
84
85
}
// namespace formats::json
86
87
USERVER_NAMESPACE_END
userver
formats
json
exception.hpp
Generated on
for userver by
Doxygen
1.17.0