BSON_ERRORS(3)

πŸ“¦
version 1.26.0 Β· 3 versions
, in ubuntu noble

πŸ’– BSON_ERRORS(3) πŸ’–

okay bestie, welcome to libbson's error handling page β€” yes it's the manual page BSON_ERRORS(3) from libbson, and yes we're gonna make error codes cute. sit down, hydrate, let's go. 🫢


✨ DESCRIPTION ✨

so here's the tea: a LOT of libbson functions don't throw, they don't scream, they just quietly hand you back NULL or -1 and stuff the drama into a bson_error_t structure for you. that struct has three little fields and honestly they're iconic:

  • error.domain β€” names the subsystem that generated the error. like, who did this. πŸ•΅οΈ
  • error.code β€” a domain-specific error type. the specifics of the crime.
  • error.message β€” describes the error. the narration, the storytelling, the whole monologue. πŸ’…
⚠️ okay important: some error codes overlap with others. always check both the domain and code to determine the type of error. do not skip this. i'm so serious. check both or you WILL be confused and i WILL say i told you so. 😭

🌈 the error domains, decoded 🌈

BSON_ERROR_JSON πŸ¦‹

this one is the MongoDB Extended JSON girlie. the codes in this domain are:

  • BSON_JSON_ERROR_READ_CORRUPT_JS
  • BSON_JSON_ERROR_READ_INVALID_PARAM
  • BSON_JSON_ERROR_READ_CB_FAILURE

and the vibe here is bson_json_reader_t, which tried to parse invalid MongoDB Extended JSON. let's break that down fr fr:

  • Tried to parse a valid JSON document that is invalid as MongoDB Extended JSON. 😡
  • An internal callback failure during JSON parsing. πŸ’€

BSON_ERROR_READER πŸŽ€

the reader domain, the file-opening domain, the "why won't it just open" domain:

  • BSON_ERROR_READER_BADFD β€” this one shows up when bson_json_reader_new_from_file() could not open the file. that's it. that's the whole story. the file said no. πŸ™ˆ

πŸ‘‘ AUTHOR πŸ‘‘

MongoDB, Inc β€” yes, the whole company. slay.


2017-present, MongoDB, Inc


and that's the page bestie, no cap, every flag and code accounted for πŸ’œ

version 1.26.0, dated Mar 31, 2024 β€” libbson's finest. mwah. πŸ’‹ go check your domains AND your codes. 🧚

πŸ“¦ where this page comes from