---
name: "bson_errors"
section: "3"
platform: "linux"
package: "libbson-doc"
version: "1.23.1-1+deb12u3"
release: "Debian 12 (Bookworm)"
platforms: ["linux"]
url: "https://new.carta.tech/bson_errors"
---

# bson\_errors(3)

Handling Errors

## NAME

bson\_errors - Handling Errors

## DESCRIPTION

Many libbson functions report errors by returning **NULL** or -1 and filling out a *bson\_error\_t* structure with an error domain, error code, and message.

- •

  **error.domain** names the subsystem that generated the error.

- •

  **error.code** is a domain-specific error type.

- •

  **error.message** describes the error.

Some error codes overlap with others; always check both the domain and code to determine the type of error.

| | | |
| --- | --- | --- |
| **BSON\_ERROR\_JSON** | **BSON\_JSON\_ERROR\_READ\_CORRUPT\_JS** **BSON\_JSON\_ERROR\_READ\_INVALID\_PARAM** **BSON\_JSON\_ERROR\_READ\_CB\_FAILURE** | *bson\_json\_reader\_t* tried to parse invalid MongoDB Extended JSON. Tried to parse a valid JSON document that is invalid as MongoDBExtended JSON. An internal callback failure during JSON parsing. |
| **BSON\_ERROR\_READER** | **BSON\_ERROR\_READER\_BADFD** | *bson\_json\_reader\_new\_from\_file()* could not open the file. |

## AUTHOR

MongoDB, Inc

## COPYRIGHT

2017-present, MongoDB, Inc
