Skip to content

Commit 71b8afb

Browse files
committed
refactor error API: update docs
1 parent 0491c91 commit 71b8afb

1 file changed

Lines changed: 17 additions & 12 deletions

File tree

changelog/current.md

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,23 @@
11
### Improvements
22

3-
- [PR#503](https://github.com/biojppm/rapidyaml/pull/503) (fixes ): change error callbacks. Errors in ryml now have one of these types:
4-
- parse error: when parsing YAML/JSON. See: `pfn_error_parse`, `ErrorDataParse`, `ExceptionParse`, `err_parse_format()`.
5-
- visit error: when visiting a tree (reading or writing). See: `pfn_error_visit`, `ErrorDataVisit`, `ExceptionVisit`, `err_visit_format()`.
6-
- basic error: other, non specific errors. See: `pfn_error_basic`, `ErrorDataBasic`, `ExceptionBasic`, `err_basic_format()`.
7-
- parse and visit errors/exceptions can be treated/caught as basic errors/exceptions
3+
- [PR#503](https://github.com/biojppm/rapidyaml/pull/503) (fixes [#399](https://github.com/biojppm/rapidyaml/issues/399)): change error callbacks.
4+
- Errors in ryml now have one of these types:
5+
- parse error: when parsing YAML/JSON. See: `pfn_error_parse`, `ErrorDataParse`, `ExceptionParse`, `err_parse_format()`, `sample_error_parse`.
6+
- visit error: when visiting a tree (reading or writing). See: `pfn_error_visit`, `ErrorDataVisit`, `ExceptionVisit`, `err_visit_format()`, `sample_error_visit`.
7+
- basic error: other, non specific errors. See: `pfn_error_basic`, `ErrorDataBasic`, `ExceptionBasic`, `err_basic_format()`, `sample_error_basic`.
8+
- parse and visit errors/exceptions can be treated/caught as basic errors/exceptions
89
- Add message formatting functions to simplify implementation of error callbacks:
9-
- `err_parse_format()`
10-
- `err_visit_format()`
11-
- `err_basic_format()`
12-
- `location_format()`
13-
- `location_format_with_context()`: useful to create a rich error message showing the region causing the error.
14-
- The functions above receive are generic, and can be used to a function
15-
- `Location`:
10+
- `err_parse_format()`: format/print a full error message for a parse error
11+
- `err_visit_format()`: format/print a full error message for a visit error
12+
- `err_basic_format()`: format/print a full error message for a basic error
13+
- `location_format()`: format/print a location
14+
- `location_format_with_context()`: useful to create a rich error message showing the YAML region causing the error, maybe even for a visit error if the source is kept and locations are enabled.
15+
- See the new header `c4/yml/error.hpp` (and `c4/yml/error.def.hpp` for definitions of the functions in `c4/yml/error.hpp`)
16+
- See the relevant sample functions in the quickstart sample: `sample_error_basic`, `sample_error_parse` and `sample_error_visit`.
17+
- There are breaking user-facing changes in the `Callbacks` structure:
18+
- Removed member `m_error `
19+
- Added members `m_error_basic`, `m_error_parse`, `m_error_visit`
20+
- Added methods `.set_error_basic()`, `.set_error_parse()` and `.set_error_visit()`.
1621

1722

1823
### Fixes

0 commit comments

Comments
 (0)