File: exceptions.md

package info (click to toggle)
glaze 6.5.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 7,948 kB
  • sloc: cpp: 121,839; sh: 99; ansic: 26; makefile: 13
file content (13 lines) | stat: -rw-r--r-- 451 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
# Glaze Exceptions

If C++ exceptions are being used in your codebase, it can be cleaner to call functions that throw.

Glaze provides a header `glaze_exceptions.hpp`, which provides an API to use Glaze with exceptions. This header will be disabled if `-fno-exceptions` is specified.

> Glaze functions that throw exceptions use the namespace `glz::ex`

```c++
std::string buffer{};
glz::ex::read_json(obj, buffer); // will throw on a read error
```