MongoDB C++ Driver mongocxx-3.11.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 <cstdint>
18#include <system_error>
19
21
23
24namespace bsoncxx {
25namespace v_noabi {
26
30enum class error_code : std::int32_t {
33
36
39
42
45
70
73
76
79
82
85
88
91
94
97
100
103
106
109
112
115
118
143
146
149
150 // Add new constant string message to error_code.cpp as well!
151};
152
158BSONCXX_ABI_EXPORT_CDECL(const std::error_category&) error_category();
159
166inline std::error_code make_error_code(error_code error) {
167 return {static_cast<int>(error), error_category()};
168}
169
170} // namespace v_noabi
171} // namespace bsoncxx
172
173namespace bsoncxx {
174
175using ::bsoncxx::v_noabi::error_category;
176using ::bsoncxx::v_noabi::make_error_code;
177
178} // namespace bsoncxx
179
181
182namespace std {
183
188template <>
189struct is_error_code_enum<bsoncxx::v_noabi::error_code> : public true_type {};
190
191} // namespace std
192
197
198#if defined(BSONCXX_PRIVATE_DOXYGEN_PREPROCESSOR)
199
200namespace bsoncxx {
201
203const std::error_category& error_category();
204
207
208} // namespace bsoncxx
209
210#endif // defined(BSONCXX_PRIVATE_DOXYGEN_PREPROCESSOR)
The bsoncxx macro guard postlude header.
The bsoncxx macro guard prelude header.
Declares bsoncxx::v_noabi::error_code.
#define BSONCXX_ABI_EXPORT_CDECL(...)
Equivalent to BSONCXX_ABI_EXPORT with BSONCXX_ABI_CDECL.
Definition fwd.hpp:225
error_code
Enum representing the various error types that can occur while operating on BSON values.
Definition error_code.hpp:30
@ k_cannot_append_int32
Failed to append a value of the given type.
@ k_cannot_append_date
Failed to append a value of the given type.
@ k_no_array_to_close
An array was closed while no array was open.
@ k_cannot_append_key_in_sub_array
A new key was appended while building a subarray.
@ k_need_element_type_k_minkey
The underlying value does not have the requested type.
@ k_need_element_type_k_dbpointer
The underlying value does not have the requested type.
@ k_unmatched_key_in_builder
Attempted to view or extract a document when a key was still awaiting a matching value.
@ k_cannot_append_decimal128
Failed to append a value of the given type.
@ k_cannot_append_symbol
Failed to append a value of the given type.
@ k_cannot_begin_appending_document
Failed to begin appending a BSON document to a BSON document or array.
@ k_failed_converting_bson_to_json
This type is unused and deprecated.
@ k_cannot_append_maxkey
Failed to append a value of the given type.
@ k_cannot_close_document_in_sub_array
A subdocument was closed while building a subarray.
@ k_need_key
No key was provided when one was needed.
@ k_cannot_append_string
Failed to append a value of the given type.
@ k_need_element_type_k_array
The underlying value does not have the requested type.
@ k_cannot_append_utf8
Failed to append a value of the given type.
@ k_need_element_type_k_document
The underlying value does not have the requested type.
@ k_need_element_type_k_int64
The underlying value does not have the requested type.
@ k_cannot_append_codewscope
Failed to append a value of the given type.
@ k_unset_element
An empty element was accessed.
@ k_json_parse_failure
A JSON document failed to parse.
@ k_need_element_type_k_double
The underlying value does not have the requested type.
@ k_internal_error
BSON data could not be processed, but no specific reason was available.
@ k_cannot_perform_array_operation_on_document
An array operation was performed while building a document.
@ k_cannot_append_dbpointer
Failed to append a value of the given type.
@ k_invalid_bson_type_id
Invalid type.
@ k_cannot_append_binary
Failed to append a value of the given type.
@ k_need_element_type_k_undefined
The underlying value does not have the requested type.
@ k_cannot_append_double
Failed to append a value of the given type.
@ k_need_element_type_k_string
The underlying value does not have the requested type.
@ k_cannot_append_timestamp
Failed to append a value of the given type.
@ k_cannot_perform_document_operation_on_array
A document operation was performed while building an array.
@ k_cannot_append_int64
Failed to append a value of the given type.
@ k_need_element_type_k_decimal128
The underlying value does not have the requested type.
@ k_cannot_append_minkey
Failed to append a value of the given type.
@ k_need_element_type_k_date
The underlying value does not have the requested type.
@ k_need_element_type_k_binary
The underlying value does not have the requested type.
@ k_cannot_end_appending_array
Failed to complete appending an array to a BSON document or array.
@ k_cannot_append_document
Failed to append a value of the given type.
@ k_need_element_type_k_regex
The underlying value does not have the requested type.
@ k_need_element_type_k_codewscope
The underlying value does not have the requested type.
@ k_cannot_append_bool
Failed to append a value of the given type.
@ k_need_element_type_k_maxkey
The underlying value does not have the requested type.
@ k_cannot_append_code
Failed to append a value of the given type.
@ k_cannot_append_array
Failed to append a value of the given type.
@ k_need_element_type_k_bool
The underlying value does not have the requested type.
@ k_need_element_type_k_code
The underlying value does not have the requested type.
@ k_cannot_append_oid
Failed to append a value of the given type.
@ k_invalid_decimal128
A Decimal128 string failed to parse.
@ k_no_document_to_close
A document was closed while no document was open.
@ k_need_element_type_k_null
The underlying value does not have the requested type.
@ k_need_element_type_k_int32
The underlying value does not have the requested type.
@ k_cannot_append_null
Failed to append a value of the given type.
@ k_need_element_type_k_symbol
The underlying value does not have the requested type.
@ k_cannot_begin_appending_array
Failed to begin appending an array to a BSON document or array.
@ k_need_element_type_k_oid
The underlying value does not have the requested type.
@ k_cannot_append_regex
Failed to append a value of the given type.
@ k_need_element_type_k_timestamp
The underlying value does not have the requested type.
@ k_cannot_append_undefined
Failed to append a value of the given type.
@ k_invalid_oid
An Object ID string failed to parse.
@ k_cannot_close_array_in_sub_document
A subarray was closed while building a subdocument.
@ k_invalid_binary_subtype
Invalid binary subtype.
@ k_cannot_end_appending_document
Failed to complete appending a BSON document to a BSON document or array.
const std::error_category & 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:166
The top-level namespace within which all bsoncxx library entities are declared.
std::error_code make_error_code(v_noabi::error_code error)
bsoncxx::v_noabi::make_error_code(v_noabi::error_code error)
const std::error_category & error_category()
bsoncxx::v_noabi::error_category()
The top-level namespace reserved for the C++ standard library.