Dev Essential  1.6.3
Loading...
Searching...
No Matches
ddl_error.h
Go to the documentation of this file.
1
14
15#ifndef DDL_UTILITY_ERROR_H_INCLUDED
16#define DDL_UTILITY_ERROR_H_INCLUDED
17
19
20#include <stdexcept>
21#include <vector>
22
23namespace ddl {
24namespace dd {
25
31class Error : public std::exception {
32private:
33 static std::string joinArgs(const std::vector<std::string>& oo_operation_args);
34
35public:
42 Error(const std::string& oo_type_operation, const std::string& message)
43 : _message(oo_type_operation + ": " + message)
44 {
45 _problems.push_back({oo_type_operation, message});
46 }
47
55 Error(const std::string& oo_type_operation,
56 const std::vector<std::string>& oo_operation_args,
57 const std::string& message)
58 : _message(oo_type_operation + "(" + joinArgs(oo_operation_args) + ")" + ": " + message)
59 {
60 _problems.push_back({oo_type_operation + "(" + joinArgs(oo_operation_args) + ")", message});
61 }
62
71 Error(const std::string& oo_type_operation,
72 const std::vector<std::string>& oo_operation_args,
73 const std::string& message,
74 const std::vector<Problem>& problems)
75 : _message(oo_type_operation + "(" + joinArgs(oo_operation_args) + ")" + ": " + message),
76 _problems(problems)
77 {
78 }
79
83 const std::vector<Problem>& problems() const
84 {
85 return _problems;
86 }
87
92 char const* what() const noexcept override
93 {
94 return _message.c_str();
95 }
96
97private:
98 std::string _message;
99 std::vector<Problem> _problems;
100};
101
102} // namespace dd
103
104namespace utility {
105// (usually Problem class should be moved to utility namespace, but we stay binary compatible for
106// now!)
111
112} // namespace utility
113} // namespace ddl
114
115#endif // DD_ERROR_H_INCLUDED
Exception helper class to collect information while parsing, adding DD Objects or other failed operat...
Definition ddl_error.h:31
Error(const std::string &oo_type_operation, const std::string &message)
CTOR.
Definition ddl_error.h:42
char const * what() const noexcept override
Definition ddl_error.h:92
Error(const std::string &oo_type_operation, const std::vector< std::string > &oo_operation_args, const std::string &message, const std::vector< Problem > &problems)
CTOR with arguments.
Definition ddl_error.h:71
const std::vector< Problem > & problems() const
Definition ddl_error.h:83
Error(const std::string &oo_type_operation, const std::vector< std::string > &oo_operation_args, const std::string &message)
CTOR with arguments.
Definition ddl_error.h:55
definition of the dd namespace
Definition datamodel_base.h:26
::ddl::dd::Error Error
Exception helper class to collect information while parsing, adding DD Objects or other failed operat...
Definition ddl_error.h:110
definition of the ddl namespace
Definition codec.h:21