BSON_ERROR_T(3)

πŸ’– BSON Error Encapsulation πŸ’–

okay so bestie, welcome to the libbson manual page for BSON_ERROR_T(3) β€” this is the whole vibe on how BSON wraps up its error info for you. 🫢

✨ SYNOPSIS ✨

#include <bson/bson.h>

typedef struct {
   uint32_t domain;
   uint32_t code;
   char message[504];
} bson_error_t;

🌸 DESCRIPTION 🌸

The bson_error_t structure is literally your little error-info delivery package β€” it’s used as an out-parameter to pass error information back to the caller. πŸ“¦βœ¨

Stack-allocate it, bestie. It should be stack-allocated, and it does not require freeing. No cleanup era needed. πŸ’…

See Handling Errors. iykyk.

πŸ¦‹ EXAMPLE πŸ¦‹

bson_reader_t *reader;
bson_error_t error;

reader = bson_reader_new_from_file ("dump.bson", &error);
if (!reader) {
   fprintf (
      stderr, "ERROR: %d.%d: %s\n", error.domain, error.code, error.message);
}

πŸ‘‘ AUTHOR πŸ‘‘

MongoDB, Inc.

2009-present, MongoDB, Inc.


xoxo, your libbson bestie πŸ’œ β€” version 2.5.6, dated Oct 09, 2026, page BSON_ERROR_T(3), slaying as always. πŸŽ€βœ¨

πŸ“¦ where this page comes from