35#include <spdlog/spdlog.h>
37#include <pdi/pdi_fwd.h>
41class PDI_EXPORT
Error:
public std::exception
62 template <
typename S,
typename... Args>
65 , m_what{fmt::format(format_str,
std::forward<Args>(args)...)}
74 const char*
what() const noexcept override;
85 template <
typename S,
typename... Args>
98 template <
typename S,
typename... Args>
102 std::ostringstream err_msg;
103 if (!PC_status(tree) && tree.node) {
104 if (tree.node->start_mark.line == tree.node->end_mark.line) {
105 err_msg <<
"Config_error in line " << tree.node->start_mark.line + 1 <<
": ";
107 err_msg <<
"Config_error in lines " << tree.node->start_mark.line + 1 <<
" - " << tree.node->end_mark.line <<
": ";
110 err_msg <<
"Config_error: ";
112 err_msg << fmt::format(format_str, std::forward<Args>(args)...);
113 m_what = err_msg.str();
124 template <
typename S,
typename... Args>
137 template <
typename S,
typename... Args>
150 template <
typename S,
typename... Args>
163 template <
typename S,
typename... Args>
176 template <
typename S,
typename... Args>
189 template <
typename S,
typename... Args>
202 template <
typename S,
typename... Args>
Config_error(const Config_error &)=default
Config_error(Config_error &&)=default
Config_error(PC_tree_t tree, const S &format_str, Args &&... args)
Definition: error.h:99
Error(PDI_status_t errcode)
Creates a PDI error without a message.
PDI_status_t m_status
status of the error
Definition: error.h:45
Error(PDI_status_t errcode, const char *message)
Creates a PDI error.
Error(PDI_status_t errcode, const S &format_str, Args &&... args)
Creates a PDI error.
Definition: error.h:63
const char * what() const noexcept override
std::string m_what
message of the error
Definition: error.h:48
Impl_error(const Impl_error &)=default
Impl_error(Impl_error &&)=default
Impl_error(const S &format_str, Args &&... args)
Definition: error.h:151
Plugin_error(const S &format_str, Args &&... args)
Definition: error.h:138
Plugin_error(Plugin_error &&)=default
Plugin_error(const Plugin_error &)=default
Right_error(Right_error &&)=default
Right_error(const Right_error &)=default
Right_error(const S &format_str, Args &&... args)
Definition: error.h:190
State_error(State_error &&)=default
State_error(const S &format_str, Args &&... args)
Definition: error.h:177
State_error(const State_error &)=default
System_error(const S &format_str, Args &&... args)
Definition: error.h:164
System_error(const System_error &)=default
System_error(System_error &&)=default
Type_error(Type_error &&)=default
Type_error(const Type_error &)=default
Type_error(const S &format_str, Args &&... args)
Definition: error.h:203
Unavailable_error(Unavailable_error &&)=default
Unavailable_error(const Unavailable_error &)=default
Unavailable_error(const S &format_str, Args &&... args)
Definition: error.h:86
Value_error(Value_error &&)=default
Value_error(const Value_error &)=default
Value_error(const S &format_str, Args &&... args)
Definition: error.h:125
PDI_status_t
Error codes of PDI.
Definition: pdi.h:73
@ PDI_UNAVAILABLE
on an input call, no such data is available
Definition: pdi.h:77
@ PDI_ERR_VALUE
A value expression is invalid.
Definition: pdi.h:81
@ PDI_ERR_STATE
A call to a function has been made at a wrong time (e.g.
Definition: pdi.h:91
@ PDI_ERR_CONFIG
The configuration file is invalid.
Definition: pdi.h:79
@ PDI_ERR_TYPE
Invalid type error.
Definition: pdi.h:95
@ PDI_ERR_SYSTEM
A system error occured (OS, etc.)
Definition: pdi.h:87
@ PDI_ERR_IMPL
Implementation limitation (typically an unimplemented feature)
Definition: pdi.h:85
@ PDI_ERR_PLUGIN
Tried to load a non-existing plugin.
Definition: pdi.h:83
@ PDI_ERR_RIGHT
A conflict of onwership over a content has been raised.
Definition: pdi.h:93
Definition: array_datatype.h:38