Loading...
Searching...
No Matches
error_code.hpp
Go to the documentation of this file.
// Copyright 2009-present MongoDB, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#pragma once
#include <bsoncxx/exception/error_code-fwd.hpp> // IWYU pragma: export
//
#include <bsoncxx/v1/exception.hpp> // IWYU pragma: export
#include <cstdint>
#include <system_error>
#include <bsoncxx/config/prelude.hpp>
namespace bsoncxx {
namespace v_noabi {
enum class error_code : std::int32_t {
k_cannot_append_key_in_sub_array = 1,
k_cannot_close_array_in_sub_document,
k_cannot_close_document_in_sub_array,
k_cannot_perform_array_operation_on_document,
k_cannot_perform_document_operation_on_array,
k_need_element_type_k_double,
k_need_element_type_k_string,
k_need_element_type_k_document,
k_need_element_type_k_array,
k_need_element_type_k_binary,
k_need_element_type_k_undefined,
k_need_element_type_k_oid,
k_need_element_type_k_bool,
k_need_element_type_k_date,
k_need_element_type_k_null,
k_need_element_type_k_regex,
k_need_element_type_k_dbpointer,
k_need_element_type_k_code,
k_need_element_type_k_symbol,
k_need_element_type_k_codewscope,
k_need_element_type_k_int32,
k_need_element_type_k_timestamp,
k_need_element_type_k_int64,
k_need_element_type_k_decimal128,
k_need_element_type_k_maxkey,
k_need_element_type_k_minkey,
k_need_key,
k_no_array_to_close,
k_no_document_to_close,
k_unmatched_key_in_builder,
k_unset_element,
k_json_parse_failure,
k_invalid_oid,
k_failed_converting_bson_to_json,
k_invalid_decimal128,
k_internal_error,
k_cannot_begin_appending_array,
k_cannot_begin_appending_document,
k_cannot_end_appending_array,
k_cannot_end_appending_document,
k_invalid_binary_subtype,
k_invalid_bson_type_id,
k_cannot_append_double,
k_cannot_append_string,
k_cannot_append_document,
k_cannot_append_array,
k_cannot_append_binary,
k_cannot_append_undefined,
k_cannot_append_oid,
k_cannot_append_bool,
k_cannot_append_date,
k_cannot_append_null,
k_cannot_append_regex,
k_cannot_append_dbpointer,
k_cannot_append_code,
k_cannot_append_symbol,
k_cannot_append_codewscope,
k_cannot_append_int32,
k_cannot_append_timestamp,
k_cannot_append_int64,
k_cannot_append_decimal128,
k_cannot_append_maxkey,
k_cannot_append_minkey,
k_invalid_vector,
k_vector_too_large,
k_vector_out_of_range,
// Add new constant string message to error_code.cpp as well!
};
BSONCXX_ABI_EXPORT_CDECL_UNSTABLE(std::error_category const&) error_category();
inline std::error_code make_error_code(error_code error) {
return {static_cast<int>(error), error_category()};
}
} // namespace v_noabi
} // namespace bsoncxx
namespace bsoncxx {
using v_noabi::error_category;
using v_noabi::make_error_code;
} // namespace bsoncxx
#include <bsoncxx/config/postlude.hpp>
namespace std {
template <>
struct is_error_code_enum<bsoncxx::v_noabi::error_code> : public true_type {};
} // namespace std
exception.hpp
Provides bsoncxx error-handling utilities.
BSONCXX_ABI_EXPORT_CDECL_UNSTABLE
#define BSONCXX_ABI_EXPORT_CDECL_UNSTABLE(...)
Equivalent to BSONCXX_ABI_EXPORT_UNSTABLE with BSONCXX_ABI_CDECL.
Definition config.hpp:28
postlude.hpp
The bsoncxx v_noabi macro guard postlude header.
prelude.hpp
The bsoncxx v_noabi macro guard prelude header.
error_code-fwd.hpp
Declares bsoncxx::v_noabi::error_code.
bsoncxx::v1::source_errc::bsoncxx
@ bsoncxx
From the bsoncxx library.
Definition exception.hpp:37
bsoncxx::v_noabi
Declares entities whose ABI stability is NOT guaranteed.
bsoncxx::v_noabi::error_code
error_code
Enum representing the various error types that can occur while operating on BSON values.
Definition error_code.hpp:36
bsoncxx::v_noabi::error_code::k_cannot_append_int32
@ k_cannot_append_int32
Failed to append a value of the given type.
Definition error_code.hpp:142
bsoncxx::v_noabi::error_code::k_cannot_append_date
@ k_cannot_append_date
Failed to append a value of the given type.
Definition error_code.hpp:135
bsoncxx::v_noabi::error_code::k_no_array_to_close
@ k_no_array_to_close
An array was closed while no array was open.
Definition error_code.hpp:81
bsoncxx::v_noabi::error_code::k_cannot_append_key_in_sub_array
@ k_cannot_append_key_in_sub_array
A new key was appended while building a subarray.
Definition error_code.hpp:38
bsoncxx::v_noabi::error_code::k_need_element_type_k_minkey
@ k_need_element_type_k_minkey
The underlying value does not have the requested type.
Definition error_code.hpp:74
bsoncxx::v_noabi::error_code::k_need_element_type_k_dbpointer
@ k_need_element_type_k_dbpointer
The underlying value does not have the requested type.
Definition error_code.hpp:65
bsoncxx::v_noabi::error_code::k_unmatched_key_in_builder
@ 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
bsoncxx::v_noabi::error_code::k_cannot_append_decimal128
@ k_cannot_append_decimal128
Failed to append a value of the given type.
Definition error_code.hpp:145
bsoncxx::v_noabi::error_code::k_cannot_append_symbol
@ k_cannot_append_symbol
Failed to append a value of the given type.
Definition error_code.hpp:140
bsoncxx::v_noabi::error_code::k_cannot_begin_appending_document
@ k_cannot_begin_appending_document
Failed to begin appending a BSON document to a BSON document or array.
Definition error_code.hpp:111
bsoncxx::v_noabi::error_code::k_failed_converting_bson_to_json
@ k_failed_converting_bson_to_json
This type is unused and deprecated.
Definition error_code.hpp:99
bsoncxx::v_noabi::error_code::k_vector_too_large
@ k_vector_too_large
A BSON Binary Vector would be too large to represent.
Definition error_code.hpp:154
bsoncxx::v_noabi::error_code::k_cannot_append_maxkey
@ k_cannot_append_maxkey
Failed to append a value of the given type.
Definition error_code.hpp:146
bsoncxx::v_noabi::error_code::k_cannot_close_document_in_sub_array
@ k_cannot_close_document_in_sub_array
A subdocument was closed while building a subarray.
Definition error_code.hpp:44
bsoncxx::v_noabi::error_code::k_need_key
@ k_need_key
No key was provided when one was needed.
Definition error_code.hpp:78
bsoncxx::v_noabi::error_code::k_cannot_append_string
@ k_cannot_append_string
Failed to append a value of the given type.
Definition error_code.hpp:128
bsoncxx::v_noabi::error_code::k_need_element_type_k_array
@ k_need_element_type_k_array
The underlying value does not have the requested type.
Definition error_code.hpp:57
bsoncxx::v_noabi::error_code::k_need_element_type_k_document
@ k_need_element_type_k_document
The underlying value does not have the requested type.
Definition error_code.hpp:56
bsoncxx::v_noabi::error_code::k_need_element_type_k_int64
@ k_need_element_type_k_int64
The underlying value does not have the requested type.
Definition error_code.hpp:71
bsoncxx::v_noabi::error_code::k_cannot_append_codewscope
@ k_cannot_append_codewscope
Failed to append a value of the given type.
Definition error_code.hpp:141
bsoncxx::v_noabi::error_code::k_unset_element
@ k_unset_element
An empty element was accessed.
Definition error_code.hpp:90
bsoncxx::v_noabi::error_code::k_json_parse_failure
@ k_json_parse_failure
A JSON document failed to parse.
Definition error_code.hpp:93
bsoncxx::v_noabi::error_code::k_need_element_type_k_double
@ k_need_element_type_k_double
The underlying value does not have the requested type.
Definition error_code.hpp:54
bsoncxx::v_noabi::error_code::k_internal_error
@ k_internal_error
BSON data could not be processed, but no specific reason was available.
Definition error_code.hpp:105
bsoncxx::v_noabi::error_code::k_cannot_perform_array_operation_on_document
@ k_cannot_perform_array_operation_on_document
An array operation was performed while building a document.
Definition error_code.hpp:47
bsoncxx::v_noabi::error_code::k_cannot_append_dbpointer
@ k_cannot_append_dbpointer
Failed to append a value of the given type.
Definition error_code.hpp:138
bsoncxx::v_noabi::error_code::k_invalid_bson_type_id
@ k_invalid_bson_type_id
Invalid type.
Definition error_code.hpp:123
bsoncxx::v_noabi::error_code::k_cannot_append_binary
@ k_cannot_append_binary
Failed to append a value of the given type.
Definition error_code.hpp:131
bsoncxx::v_noabi::error_code::k_need_element_type_k_undefined
@ k_need_element_type_k_undefined
The underlying value does not have the requested type.
Definition error_code.hpp:59
bsoncxx::v_noabi::error_code::k_cannot_append_double
@ k_cannot_append_double
Failed to append a value of the given type.
Definition error_code.hpp:127
bsoncxx::v_noabi::error_code::k_need_element_type_k_string
@ k_need_element_type_k_string
The underlying value does not have the requested type.
Definition error_code.hpp:55
bsoncxx::v_noabi::error_code::k_cannot_append_timestamp
@ k_cannot_append_timestamp
Failed to append a value of the given type.
Definition error_code.hpp:143
bsoncxx::v_noabi::error_code::k_cannot_perform_document_operation_on_array
@ k_cannot_perform_document_operation_on_array
A document operation was performed while building an array.
Definition error_code.hpp:50
bsoncxx::v_noabi::error_code::k_cannot_append_int64
@ k_cannot_append_int64
Failed to append a value of the given type.
Definition error_code.hpp:144
bsoncxx::v_noabi::error_code::k_need_element_type_k_decimal128
@ k_need_element_type_k_decimal128
The underlying value does not have the requested type.
Definition error_code.hpp:72
bsoncxx::v_noabi::error_code::k_cannot_append_minkey
@ k_cannot_append_minkey
Failed to append a value of the given type.
Definition error_code.hpp:147
bsoncxx::v_noabi::error_code::k_need_element_type_k_date
@ k_need_element_type_k_date
The underlying value does not have the requested type.
Definition error_code.hpp:62
bsoncxx::v_noabi::error_code::k_need_element_type_k_binary
@ k_need_element_type_k_binary
The underlying value does not have the requested type.
Definition error_code.hpp:58
bsoncxx::v_noabi::error_code::k_cannot_end_appending_array
@ k_cannot_end_appending_array
Failed to complete appending an array to a BSON document or array.
Definition error_code.hpp:114
bsoncxx::v_noabi::error_code::k_cannot_append_document
@ k_cannot_append_document
Failed to append a value of the given type.
Definition error_code.hpp:129
bsoncxx::v_noabi::error_code::k_need_element_type_k_regex
@ k_need_element_type_k_regex
The underlying value does not have the requested type.
Definition error_code.hpp:64
bsoncxx::v_noabi::error_code::k_need_element_type_k_codewscope
@ k_need_element_type_k_codewscope
The underlying value does not have the requested type.
Definition error_code.hpp:68
bsoncxx::v_noabi::error_code::k_cannot_append_bool
@ k_cannot_append_bool
Failed to append a value of the given type.
Definition error_code.hpp:134
bsoncxx::v_noabi::error_code::k_need_element_type_k_maxkey
@ k_need_element_type_k_maxkey
The underlying value does not have the requested type.
Definition error_code.hpp:73
bsoncxx::v_noabi::error_code::k_cannot_append_code
@ k_cannot_append_code
Failed to append a value of the given type.
Definition error_code.hpp:139
bsoncxx::v_noabi::error_code::k_cannot_append_array
@ k_cannot_append_array
Failed to append a value of the given type.
Definition error_code.hpp:130
bsoncxx::v_noabi::error_code::k_need_element_type_k_bool
@ k_need_element_type_k_bool
The underlying value does not have the requested type.
Definition error_code.hpp:61
bsoncxx::v_noabi::error_code::k_need_element_type_k_code
@ k_need_element_type_k_code
The underlying value does not have the requested type.
Definition error_code.hpp:66
bsoncxx::v_noabi::error_code::k_cannot_append_oid
@ k_cannot_append_oid
Failed to append a value of the given type.
Definition error_code.hpp:133
bsoncxx::v_noabi::error_code::k_invalid_decimal128
@ k_invalid_decimal128
A Decimal128 string failed to parse.
Definition error_code.hpp:102
bsoncxx::v_noabi::error_code::k_no_document_to_close
@ k_no_document_to_close
A document was closed while no document was open.
Definition error_code.hpp:84
bsoncxx::v_noabi::error_code::k_need_element_type_k_null
@ k_need_element_type_k_null
The underlying value does not have the requested type.
Definition error_code.hpp:63
bsoncxx::v_noabi::error_code::k_need_element_type_k_int32
@ k_need_element_type_k_int32
The underlying value does not have the requested type.
Definition error_code.hpp:69
bsoncxx::v_noabi::error_code::k_cannot_append_null
@ k_cannot_append_null
Failed to append a value of the given type.
Definition error_code.hpp:136
bsoncxx::v_noabi::error_code::k_invalid_vector
@ k_invalid_vector
A BSON Binary Vector failed to parse in the requested format.
Definition error_code.hpp:151
bsoncxx::v_noabi::error_code::k_need_element_type_k_symbol
@ k_need_element_type_k_symbol
The underlying value does not have the requested type.
Definition error_code.hpp:67
bsoncxx::v_noabi::error_code::k_cannot_begin_appending_array
@ k_cannot_begin_appending_array
Failed to begin appending an array to a BSON document or array.
Definition error_code.hpp:108
bsoncxx::v_noabi::error_code::k_need_element_type_k_oid
@ k_need_element_type_k_oid
The underlying value does not have the requested type.
Definition error_code.hpp:60
bsoncxx::v_noabi::error_code::k_cannot_append_regex
@ k_cannot_append_regex
Failed to append a value of the given type.
Definition error_code.hpp:137
bsoncxx::v_noabi::error_code::k_need_element_type_k_timestamp
@ k_need_element_type_k_timestamp
The underlying value does not have the requested type.
Definition error_code.hpp:70
bsoncxx::v_noabi::error_code::k_cannot_append_undefined
@ k_cannot_append_undefined
Failed to append a value of the given type.
Definition error_code.hpp:132
bsoncxx::v_noabi::error_code::k_invalid_oid
@ k_invalid_oid
An Object ID string failed to parse.
Definition error_code.hpp:96
bsoncxx::v_noabi::error_code::k_vector_out_of_range
@ k_vector_out_of_range
Attempted out-of-range access to a BSON Binary Vector element.
Definition error_code.hpp:157
bsoncxx::v_noabi::error_code::k_cannot_close_array_in_sub_document
@ k_cannot_close_array_in_sub_document
A subarray was closed while building a subdocument.
Definition error_code.hpp:41
bsoncxx::v_noabi::error_code::k_invalid_binary_subtype
@ k_invalid_binary_subtype
Invalid binary subtype.
Definition error_code.hpp:120
bsoncxx::v_noabi::error_code::k_cannot_end_appending_document
@ k_cannot_end_appending_document
Failed to complete appending a BSON document to a BSON document or array.
Definition error_code.hpp:117
bsoncxx::v_noabi::error_category
std::error_category const & error_category()
Get the error_category for exceptions originating from the bsoncxx library.
bsoncxx::v_noabi::make_error_code
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
bsoncxx
The top-level namespace within which all bsoncxx library entities are declared.