1BSON_ERRORS(3) libbson BSON_ERRORS(3)
2
3
4
6 Many libbson functions report errors by returning NULL or -1 and fill‐
7 ing out a bson_error_t structure with an error domain, error code, and
8 message.
9
10 • error.domain names the subsystem that generated the error.
11
12 • error.code is a domain-specific error type.
13
14 • error.message describes the error.
15
16 Some error codes overlap with others; always check both the domain and
17 code to determine the type of error.
18
19 ┌──────────────────┬─────────────────────┬──────────────────────────────────┐
20 │BSON_ERROR_JSON │ BSON_JSON_ER‐ │ bson_json_reader_t │
21 │ │ ROR_READ_CORRUPT_JS │ tried to parse in‐ │
22 │ │ BSON_JSON_ER‐ │ valid MongoDB Ex‐ │
23 │ │ ROR_READ_IN‐ │ tended JSON. Tried │
24 │ │ VALID_PARAM │ to parse a valid │
25 │ │ BSON_JSON_ER‐ │ JSON document that │
26 │ │ ROR_READ_CB_FAILURE │ is invalid as Mon‐ │
27 │ │ │ goDBExtended JSON. │
28 │ │ │ An internal call‐ │
29 │ │ │ back failure during │
30 │ │ │ JSON parsing. │
31 ├──────────────────┼─────────────────────┼──────────────────────────────────┤
32 │BSON_ERROR_READER │ BSON_ER‐ │ bson_json_reader_new_from_file() │
33 │ │ ROR_READER_BADFD │ could not open the │
34 │ │ │ file. │
35 └──────────────────┴─────────────────────┴──────────────────────────────────┘
36
38 MongoDB, Inc
39
41 2017-present, MongoDB, Inc
42
43
44
45
461.25.1 Nov 08, 2023 BSON_ERRORS(3)