---
name: "bson_set_error"
section: "3"
platform: "linux"
package: "libbson-doc"
version: "1.30.4-1+deb13u3"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/bson_set_error"
---

# bson\_set\_error(3)

## SYNOPSIS

```
void
bson_set_error (
   bson_error_t *error, uint32_t domain, uint32_t code, const char *format, ...);
```

## PARAMETERS

- •

  **error**: A *bson\_error\_t*.

- •

  **domain**: A **uint32\_t**.

- •

  **code**: A **uint32\_t**.

- •

  **format**: A **printf()** style format string.

## DESCRIPTION

This is a helper function to set the parameters of a *bson\_error\_t*. It handles the case where **error** is NULL by doing nothing.

## AUTHOR

MongoDB, Inc

## COPYRIGHT

2009-present, MongoDB, Inc.
