MongoDB C++ Driver 4.2.0
Loading...
Searching...
No Matches
error_code.hpp
Go to the documentation of this file.
1// Copyright 2009-present MongoDB, Inc.
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15#pragma once
16
17#include <bsoncxx/exception/error_code-fwd.hpp> // IWYU pragma: export
18
19//
20
21#include <bsoncxx/v1/exception.hpp> // IWYU pragma: export
22
23#include <cstdint>
24#include <system_error>
25
27
28namespace bsoncxx {
29namespace v_noabi {
30
36enum class error_code : std::int32_t {
39
42
45
48
51
76
79
82
85
88
91
94
97
100
103
106
109
112
115
118
121
124
149
152
155
158
159 // Add new constant string message to error_code.cpp as well!
160};
161
167BSONCXX_ABI_EXPORT_CDECL(std::error_category const&) error_category();
168
175inline std::error_code make_error_code(error_code error) {
176 return {static_cast<int>(error), error_category()};
177}
178
179} // namespace v_noabi
180} // namespace bsoncxx
181
182namespace bsoncxx {
183
186
187} // namespace bsoncxx
188
190
191namespace std {
192
193template <>
194struct is_error_code_enum<bsoncxx::v_noabi::error_code> : public true_type {};
195
196} // namespace std
197
#define BSONCXX_ABI_EXPORT_CDECL(...)
Equivalent to BSONCXX_ABI_EXPORT with BSONCXX_ABI_CDECL.
Definition export.hpp:52
Provides bsoncxx error-handling utilities.
The bsoncxx v_noabi macro guard postlude header.
The bsoncxx v_noabi macro guard prelude header.
Declares bsoncxx::v_noabi::error_code.
@ bsoncxx
From the bsoncxx library.
Definition exception.hpp:39
Declares entities whose ABI stability is NOT guaranteed.
error_code
Enum representing the various error types that can occur while operating on BSON values.
Definition error_code.hpp:36
@ k_cannot_append_int32
Failed to append a value of the given type.
Definition error_code.hpp:142
@ k_cannot_append_date
Failed to append a value of the given type.
Definition error_code.hpp:135
@ k_no_array_to_close
An array was closed while no array was open.
Definition error_code.hpp:81
@ k_cannot_append_key_in_sub_array
A new key was appended while building a subarray.
Definition error_code.hpp:38
@ k_need_element_type_k_minkey
The underlying value does not have the requested type.
Definition error_code.hpp:74
@ k_need_element_type_k_dbpointer
The underlying value does not have the requested type.
Definition error_code.hpp:65
@ k_unmatched_key_in_builder
Attempted to view or extract a document when a key was still awaiting a matching value.
Definition error_code.hpp:87
@ k_cannot_append_decimal128
Failed to append a value of the given type.
Definition error_code.hpp:145
@ k_cannot_append_symbol
Failed to append a value of the given type.
Definition error_code.hpp:140
@ k_cannot_begin_appending_document
Failed to begin appending a BSON document to a BSON document or array.
Definition error_code.hpp:111
@ k_failed_converting_bson_to_json
This type is unused and deprecated.
Definition error_code.hpp:99
@ k_vector_too_large
A BSON Binary Vector would be too large to represent.
Definition error_code.hpp:154
@ k_cannot_append_maxkey
Failed to append a value of the given type.
Definition error_code.hpp:146
@ k_cannot_close_document_in_sub_array
A subdocument was closed while building a subarray.
Definition error_code.hpp:44
@ k_need_key
No key was provided when one was needed.
Definition error_code.hpp:78
@ k_cannot_append_string
Failed to append a value of the given type.
Definition error_code.hpp:128
@ k_need_element_type_k_array
The underlying value does not have the requested type.
Definition error_code.hpp:57
@ k_need_element_type_k_document
The underlying value does not have the requested type.
Definition error_code.hpp:56
@ k_need_element_type_k_int64
The underlying value does not have the requested type.
Definition error_code.hpp:71
@ k_cannot_append_codewscope
Failed to append a value of the given type.
Definition error_code.hpp:141
@ k_unset_element
An empty element was accessed.
Definition error_code.hpp:90
@ k_json_parse_failure
A JSON document failed to parse.
Definition error_code.hpp:93
@ k_need_element_type_k_double
The underlying value does not have the requested type.
Definition error_code.hpp:54
@ k_internal_error
BSON data could not be processed, but no specific reason was available.
Definition error_code.hpp:105
@ k_cannot_perform_array_operation_on_document
An array operation was performed while building a document.
Definition error_code.hpp:47
@ k_cannot_append_dbpointer
Failed to append a value of the given type.
Definition error_code.hpp:138
@ k_invalid_bson_type_id
Invalid type.
Definition error_code.hpp:123
@ k_cannot_append_binary
Failed to append a value of the given type.
Definition error_code.hpp:131
@ k_need_element_type_k_undefined
The underlying value does not have the requested type.
Definition error_code.hpp:59
@ k_cannot_append_double
Failed to append a value of the given type.
Definition error_code.hpp:127
@ k_need_element_type_k_string
The underlying value does not have the requested type.
Definition error_code.hpp:55
@ k_cannot_append_timestamp
Failed to append a value of the given type.
Definition error_code.hpp:143
@ k_cannot_perform_document_operation_on_array
A document operation was performed while building an array.
Definition error_code.hpp:50
@ k_cannot_append_int64
Failed to append a value of the given type.
Definition error_code.hpp:144
@ k_need_element_type_k_decimal128
The underlying value does not have the requested type.
Definition error_code.hpp:72
@ k_cannot_append_minkey
Failed to append a value of the given type.
Definition error_code.hpp:147
@ k_need_element_type_k_date
The underlying value does not have the requested type.
Definition error_code.hpp:62
@ k_need_element_type_k_binary
The underlying value does not have the requested type.
Definition error_code.hpp:58
@ k_cannot_end_appending_array
Failed to complete appending an array to a BSON document or array.
Definition error_code.hpp:114
@ k_cannot_append_document
Failed to append a value of the given type.
Definition error_code.hpp:129
@ k_need_element_type_k_regex
The underlying value does not have the requested type.
Definition error_code.hpp:64
@ k_need_element_type_k_codewscope
The underlying value does not have the requested type.
Definition error_code.hpp:68
@ k_cannot_append_bool
Failed to append a value of the given type.
Definition error_code.hpp:134
@ k_need_element_type_k_maxkey
The underlying value does not have the requested type.
Definition error_code.hpp:73
@ k_cannot_append_code
Failed to append a value of the given type.
Definition error_code.hpp:139
@ k_cannot_append_array
Failed to append a value of the given type.
Definition error_code.hpp:130
@ k_need_element_type_k_bool
The underlying value does not have the requested type.
Definition error_code.hpp:61
@ k_need_element_type_k_code
The underlying value does not have the requested type.
Definition error_code.hpp:66
@ k_cannot_append_oid
Failed to append a value of the given type.
Definition error_code.hpp:133
@ k_invalid_decimal128
A Decimal128 string failed to parse.
Definition error_code.hpp:102
@ k_no_document_to_close
A document was closed while no document was open.
Definition error_code.hpp:84
@ k_need_element_type_k_null
The underlying value does not have the requested type.
Definition error_code.hpp:63
@ k_need_element_type_k_int32
The underlying value does not have the requested type.
Definition error_code.hpp:69
@ k_cannot_append_null
Failed to append a value of the given type.
Definition error_code.hpp:136
@ k_invalid_vector
A BSON Binary Vector failed to parse in the requested format.
Definition error_code.hpp:151
@ k_need_element_type_k_symbol
The underlying value does not have the requested type.
Definition error_code.hpp:67
@ k_cannot_begin_appending_array
Failed to begin appending an array to a BSON document or array.
Definition error_code.hpp:108
@ k_need_element_type_k_oid
The underlying value does not have the requested type.
Definition error_code.hpp:60
@ k_cannot_append_regex
Failed to append a value of the given type.
Definition error_code.hpp:137
@ k_need_element_type_k_timestamp
The underlying value does not have the requested type.
Definition error_code.hpp:70
@ k_cannot_append_undefined
Failed to append a value of the given type.
Definition error_code.hpp:132
@ k_invalid_oid
An Object ID string failed to parse.
Definition error_code.hpp:96
@ k_vector_out_of_range
Attempted out-of-range access to a BSON Binary Vector element.
Definition error_code.hpp:157
@ k_cannot_close_array_in_sub_document
A subarray was closed while building a subdocument.
Definition error_code.hpp:41
@ k_invalid_binary_subtype
Invalid binary subtype.
Definition error_code.hpp:120
@ k_cannot_end_appending_document
Failed to complete appending a BSON document to a BSON document or array.
Definition error_code.hpp:117
std::error_category const & error_category()
Get the error_category for exceptions originating from the bsoncxx library.
std::error_code make_error_code(error_code error)
Translate a bsoncxx::v_noabi::error_code into a std::error_code.
Definition error_code.hpp:175
The top-level namespace within which all bsoncxx library entities are declared.