userver: userver/formats/bson/exception.hpp Source File
⚠️ This is the documentation for an old userver version. Click here to switch to the latest version.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages Concepts
exception.hpp
Go to the documentation of this file.
1#pragma once
2
3/// @file userver/formats/bson/exception.hpp
4/// @brief BSON-specific exceptions
5
6#include <bson/bson.h>
7
8#include <userver/utils/traceful_exception.hpp>
9
10USERVER_NAMESPACE_BEGIN
11
12namespace formats::bson {
13
14/// Generic BSON-related exception
16 public:
17 using utils::TracefulException::TracefulException;
18};
19
20/// BSON parsing error
22 public:
23 using BsonException::BsonException;
24};
25
26/// BSON types mismatch error
28 public:
29 TypeMismatchException(bson_type_t actual, bson_type_t expected,
30 std::string_view path);
31};
32
33/// BSON array indexing error
35 public:
36 OutOfBoundsException(size_t index, size_t size, std::string_view path);
37};
38
39/// BSON nonexisting member access error
41 public:
42 explicit MemberMissingException(std::string_view path);
43};
44
45/// Conversion error
47 public:
48 using BsonException::BsonException;
49};
50
51} // namespace formats::bson
52
53USERVER_NAMESPACE_END