boostorg / json

A C++11 library for parsing and serializing JSON to and from a DOM container in memory.
https://boost.org/libs/json
Boost Software License 1.0
424 stars 94 forks source link

Documentation inconsistency about exceptions #978

Closed kuznetsss closed 5 months ago

kuznetsss commented 5 months ago

Hi, thanks for the useful library!

I think there are a few inconsistencies about whether function or method throws an exception: value::as_string():

Screenshot 2024-02-06 at 17 30 46

parse()

Screenshot 2024-02-06 at 17 34 16

In both cases it says in the description that exception could be thrown but at the same time it says Exception Safety: strongly guarantee.

grisumbras commented 5 months ago

"Strong guarantee" means that if the function throws an exception, then any of its arguments, including the object on which the function is called (if it's a member function) aren't changed. You are thinking of the no-throw guarantee.

See this document for more info: https://www.boost.org/community/exception_safety.html (section 3 discusses exception safety guarantees).

kuznetsss commented 5 months ago

Thanks for the explanation!