Leosac  0.8.0
Open Source Access Control
ModelException Class Reference

An exception class for general API error. More...

#include <ModelException.hpp>

+ Inheritance diagram for ModelException:
+ Collaboration diagram for ModelException:


struct  ModelError
 Describes a model error. More...

Public Types

using json = nlohmann::json

Public Member Functions

 ModelException (const std::string &source_pointer, const std::string &msg)
 This is an helper constructor that will instanciate a ModelError object from the 2 parameters. More...
 ModelException (const std::initializer_list< ModelError > &errors)
json json_errors () const
 Format the ModelError object(s). More...
const std::vector< ModelErrorerrors () const
 Access the vector of errors. More...
- Public Member Functions inherited from LEOSACException
 LEOSACException (const std::string &message)
virtual ~LEOSACException ()
virtual const char * what () const noexcept final
const Leosac::Tools::Stacktracetrace () const
 Get the stacktrace associated with this exception. More...

Private Attributes

std::vector< ModelErrorerrors_

Additional Inherited Members

- Protected Attributes inherited from LEOSACException
std::string message_

Detailed Description

An exception class for general API error.

The particularity of this class is that it accepts a JSON object as a parameters.

The ModelException accepts ModelException::ModelError objects as parameter.

Definition at line 33 of file ModelException.hpp.

Member Typedef Documentation

◆ json

using ModelException::json = nlohmann::json

Definition at line 36 of file ModelException.hpp.

Constructor & Destructor Documentation

◆ ModelException() [1/2]

ModelException::ModelException ( const std::string &  source_pointer,
const std::string &  msg 

This is an helper constructor that will instanciate a ModelError object from the 2 parameters.


Definition at line 23 of file ModelException.cpp.

◆ ModelException() [2/2]

ModelException::ModelException ( const std::initializer_list< ModelError > &  errors)

Member Function Documentation

◆ errors()

const std::vector< ModelException::ModelError > ModelException::errors ( ) const

Access the vector of errors.

Can be useful to analyze errors precisely.

Definition at line 57 of file ModelException.cpp.

◆ json_errors()

ModelException::json ModelException::json_errors ( ) const

Format the ModelError object(s).

Definition at line 43 of file ModelException.cpp.

Member Data Documentation

◆ errors_

std::vector<ModelError> ModelException::errors_

Definition at line 84 of file ModelException.hpp.

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