JSON Voorhees
Killer JSON for C++
Loading...
Searching...
No Matches
jsonv::deserialization_error Class Reference

Exception thrown if there is any problem running deserialize. More...

#include <jsonv/serialization/deserialize.hpp>

+ Inheritance diagram for jsonv::deserialization_error:
+ Collaboration diagram for jsonv::deserialization_error:

Classes

class  problem
 Description of a single problem with deserialization. More...
 

Public Types

using problem_list = std::vector< problem >
 

Public Member Functions

 deserialization_error (problem_list problems) noexcept
 Create a deserialization_error from the given list of problems.
 
 deserialization_error (jsonv::path path, std::exception_ptr cause) noexcept
 Create a new deserialization_error with a single problem at path, whose message is extracted from cause (see problem::problem).
 
const jsonv::path & path () const noexcept
 Get the path the first deserialization error came from.
 
const std::string & source_name () const noexcept
 Get the name of the document the first deserialization error came from (see problem::source_name).
 
const std::exception_ptr & nested_ptr () const noexcept
 Get the first problem::cause.
 
const problem_list & problems () const noexcept
 Get the list of problems which caused this deserialization_error.
 
 deserialization_error (jsonv::path path, std::string message, std::exception_ptr cause) noexcept
 Create a new deserialization_error with a single problem from the given path, message, and optional underlying cause.
 
 deserialization_error (jsonv::path path, std::string message) noexcept
 Create a new deserialization_error with a single problem from the given path, message, and optional underlying cause.
 

Detailed Description

Exception thrown if there is any problem running deserialize.

what says where each problem was found: at its problem::path, and in its problem::source_name where it has one, joined by a # as in a URI fragment – config.json#.servers[2].port. A problem with a name and an empty path is reported in the document as a whole, as config.json.

Definition at line 132 of file deserialize.hpp.

Member Typedef Documentation

◆ problem_list

using jsonv::deserialization_error::problem_list = std::vector<problem>

Definition at line 196 of file deserialize.hpp.

Constructor & Destructor Documentation

◆ deserialization_error()

jsonv::deserialization_error::deserialization_error ( problem_list  problems)
explicitnoexcept

Create a deserialization_error from the given list of problems.

Parameters
problemsThe list of problems which caused this error. It is expected that problems.size() is greater than 0. If it is not, a single problem will be created with a note about an unspecified error.

Member Function Documentation

◆ nested_ptr()

const std::exception_ptr & jsonv::deserialization_error::nested_ptr ( ) const
noexcept

Get the first problem::cause.

This can be nullptr if the first problem does not have an underlying cause.

◆ problems()

const problem_list & jsonv::deserialization_error::problems ( ) const
inlinenoexcept

Get the list of problems which caused this deserialization_error.

There will always be at least one problem in this list.

Definition at line 237 of file deserialize.hpp.

◆ source_name()

const std::string & jsonv::deserialization_error::source_name ( ) const
noexcept

Get the name of the document the first deserialization error came from (see problem::source_name).

This is empty if it was not given one.


The documentation for this class was generated from the following file: