MongoDB C++ Driver 4.1.0
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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 <cstdint>
18#include <system_error>
19
21
23
24namespace bsoncxx {
25namespace v_noabi {
26
32enum class error_code : std::int32_t {
35
38
41
44
47
72
75
78
81
84
87
90
93
96
99
102
105
108
111
114
117
120
145
148
151
154
155 // Add new constant string message to error_code.cpp as well!
156};
157
163BSONCXX_ABI_EXPORT_CDECL(std::error_category const&) error_category();
164
171inline std::error_code make_error_code(error_code error) {
172 return {static_cast<int>(error), error_category()};
173}
174
175} // namespace v_noabi
176} // namespace bsoncxx
177
178namespace bsoncxx {
179
182
183} // namespace bsoncxx
184
186
187namespace std {
188
189// @cond DOXYGEN_DISABLE
190template <>
191struct is_error_code_enum<bsoncxx::v_noabi::error_code> : public true_type {};
192// @endcond
193
194} // namespace std
195
#define BSONCXX_ABI_EXPORT_CDECL(...)
Equivalent to BSONCXX_ABI_EXPORT with BSONCXX_ABI_CDECL.
Definition export.hpp:52
The bsoncxx v_noabi macro guard postlude header.
The bsoncxx v_noabi macro guard prelude header.
Declares bsoncxx::v_noabi::error_code.
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:32
@ k_cannot_append_int32
Failed to append a value of the given type.
Definition error_code.hpp:138
@ k_cannot_append_date
Failed to append a value of the given type.
Definition error_code.hpp:131
@ k_no_array_to_close
An array was closed while no array was open.
Definition error_code.hpp:77
@ k_cannot_append_key_in_sub_array
A new key was appended while building a subarray.
Definition error_code.hpp:34
@ k_need_element_type_k_minkey
The underlying value does not have the requested type.
Definition error_code.hpp:70
@ k_need_element_type_k_dbpointer
The underlying value does not have the requested type.
Definition error_code.hpp:61
@ 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:83
@ k_cannot_append_decimal128
Failed to append a value of the given type.
Definition error_code.hpp:141
@ k_cannot_append_symbol
Failed to append a value of the given type.
Definition error_code.hpp:136
@ k_cannot_begin_appending_document
Failed to begin appending a BSON document to a BSON document or array.
Definition error_code.hpp:107
@ k_failed_converting_bson_to_json
This type is unused and deprecated.
Definition error_code.hpp:95
@ k_vector_too_large
A BSON Binary Vector would be too large to represent.
Definition error_code.hpp:150
@ k_cannot_append_maxkey
Failed to append a value of the given type.
Definition error_code.hpp:142
@ k_cannot_close_document_in_sub_array
A subdocument was closed while building a subarray.
Definition error_code.hpp:40
@ k_need_key
No key was provided when one was needed.
Definition error_code.hpp:74
@ k_cannot_append_string
Failed to append a value of the given type.
Definition error_code.hpp:124
@ k_need_element_type_k_array
The underlying value does not have the requested type.
Definition error_code.hpp:53
@ k_need_element_type_k_document
The underlying value does not have the requested type.
Definition error_code.hpp:52
@ k_need_element_type_k_int64
The underlying value does not have the requested type.
Definition error_code.hpp:67
@ k_cannot_append_codewscope
Failed to append a value of the given type.
Definition error_code.hpp:137
@ k_unset_element
An empty element was accessed.
Definition error_code.hpp:86
@ k_json_parse_failure
A JSON document failed to parse.
Definition error_code.hpp:89
@ k_need_element_type_k_double
The underlying value does not have the requested type.
Definition error_code.hpp:50
@ k_internal_error
BSON data could not be processed, but no specific reason was available.
Definition error_code.hpp:101
@ k_cannot_perform_array_operation_on_document
An array operation was performed while building a document.
Definition error_code.hpp:43
@ k_cannot_append_dbpointer
Failed to append a value of the given type.
Definition error_code.hpp:134
@ k_invalid_bson_type_id
Invalid type.
Definition error_code.hpp:119
@ k_cannot_append_binary
Failed to append a value of the given type.
Definition error_code.hpp:127
@ k_need_element_type_k_undefined
The underlying value does not have the requested type.
Definition error_code.hpp:55
@ k_cannot_append_double
Failed to append a value of the given type.
Definition error_code.hpp:123
@ k_need_element_type_k_string
The underlying value does not have the requested type.
Definition error_code.hpp:51
@ k_cannot_append_timestamp
Failed to append a value of the given type.
Definition error_code.hpp:139
@ k_cannot_perform_document_operation_on_array
A document operation was performed while building an array.
Definition error_code.hpp:46
@ k_cannot_append_int64
Failed to append a value of the given type.
Definition error_code.hpp:140
@ k_need_element_type_k_decimal128
The underlying value does not have the requested type.
Definition error_code.hpp:68
@ k_cannot_append_minkey
Failed to append a value of the given type.
Definition error_code.hpp:143
@ k_need_element_type_k_date
The underlying value does not have the requested type.
Definition error_code.hpp:58
@ k_need_element_type_k_binary
The underlying value does not have the requested type.
Definition error_code.hpp:54
@ k_cannot_end_appending_array
Failed to complete appending an array to a BSON document or array.
Definition error_code.hpp:110
@ k_cannot_append_document
Failed to append a value of the given type.
Definition error_code.hpp:125
@ k_need_element_type_k_regex
The underlying value does not have the requested type.
Definition error_code.hpp:60
@ k_need_element_type_k_codewscope
The underlying value does not have the requested type.
Definition error_code.hpp:64
@ k_cannot_append_bool
Failed to append a value of the given type.
Definition error_code.hpp:130
@ k_need_element_type_k_maxkey
The underlying value does not have the requested type.
Definition error_code.hpp:69
@ k_cannot_append_code
Failed to append a value of the given type.
Definition error_code.hpp:135
@ k_cannot_append_array
Failed to append a value of the given type.
Definition error_code.hpp:126
@ k_need_element_type_k_bool
The underlying value does not have the requested type.
Definition error_code.hpp:57
@ k_need_element_type_k_code
The underlying value does not have the requested type.
Definition error_code.hpp:62
@ k_cannot_append_oid
Failed to append a value of the given type.
Definition error_code.hpp:129
@ k_invalid_decimal128
A Decimal128 string failed to parse.
Definition error_code.hpp:98
@ k_no_document_to_close
A document was closed while no document was open.
Definition error_code.hpp:80
@ k_need_element_type_k_null
The underlying value does not have the requested type.
Definition error_code.hpp:59
@ k_need_element_type_k_int32
The underlying value does not have the requested type.
Definition error_code.hpp:65
@ k_cannot_append_null
Failed to append a value of the given type.
Definition error_code.hpp:132
@ k_invalid_vector
A BSON Binary Vector failed to parse in the requested format.
Definition error_code.hpp:147
@ k_need_element_type_k_symbol
The underlying value does not have the requested type.
Definition error_code.hpp:63
@ k_cannot_begin_appending_array
Failed to begin appending an array to a BSON document or array.
Definition error_code.hpp:104
@ k_need_element_type_k_oid
The underlying value does not have the requested type.
Definition error_code.hpp:56
@ k_cannot_append_regex
Failed to append a value of the given type.
Definition error_code.hpp:133
@ k_need_element_type_k_timestamp
The underlying value does not have the requested type.
Definition error_code.hpp:66
@ k_cannot_append_undefined
Failed to append a value of the given type.
Definition error_code.hpp:128
@ k_invalid_oid
An Object ID string failed to parse.
Definition error_code.hpp:92
@ k_vector_out_of_range
Attempted out-of-range access to a BSON Binary Vector element.
Definition error_code.hpp:153
@ k_cannot_close_array_in_sub_document
A subarray was closed while building a subdocument.
Definition error_code.hpp:37
@ k_invalid_binary_subtype
Invalid binary subtype.
Definition error_code.hpp:116
@ k_cannot_end_appending_document
Failed to complete appending a BSON document to a BSON document or array.
Definition error_code.hpp:113
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:171
The top-level namespace within which all bsoncxx library entities are declared.