19 #ifndef SBUILD_ERROR_H
20 #define SBUILD_ERROR_H
27 #include <boost/format.hpp>
28 #include <boost/type_traits.hpp>
57 const std::string&
reason):
76 return this->
reason.c_str();
109 template <
typename T>
116 typedef std::map<error_type,const char *>
map_type;
135 const std::string&
reason):
173 template <
typename A,
typename B,
typename C,
174 typename D,
typename E,
typename F>
196 template <
typename A,
typename B,
typename C,
197 typename D,
typename E,
typename F>
202 const std::runtime_error&
error,
219 template <
typename A,
typename B,
typename C,
220 typename R,
typename D,
typename E,
typename F>
239 const std::nullptr_t& value);
256 template<
typename A,
bool b>
307 template<
typename A,
bool b>
345 catch (
const std::bad_cast& discard)
355 #include <sbuild/error.tcc>
Helper class to add detail to format string.
Definition: error.h:257
error(const std::string &error, const std::string &reason)
The constructor.
Definition: error.h:134
Helper class to add reason to reason string.
Definition: error.h:308
static map_type error_strings
Mapping between error code and string.
Definition: error.h:146
add_reason_helper(std::string &reason, A const &value)
The constructor.
Definition: error.h:316
Debian source builder components.
Definition: ctty.cc:31
error(const std::string &error)
The constructor.
Definition: error.h:123
static void add_detail(boost::format &fmt, const std::nullptr_t &value)
Add detail to format string.
T error_type
The enum type providing the error codes for this type.
Definition: error.h:114
virtual const char * why() const
Get the reason for the error.
Definition: error.h:74
virtual ~error_base()
The destructor.
Definition: error.h:65
std::string const & get_reason() const
Get the reason for the error.
Definition: error.h:85
add_reason_helper(std::string &reason, A const &value)
The constructor.
Definition: error.h:335
Error exception base class.
Definition: error.h:36
std::string reason
The reason for the error.
Definition: error.h:103
Error exception class.
Definition: error.h:110
void set_reason(const std::string &reason)
Set the reason for the error.
Definition: error.h:96
error_base(const std::string &error)
The constructor.
Definition: error.h:44
virtual ~error()
The destructor.
Definition: error.h:141
std::map< error_type, const char * > map_type
Mapping between error code and error description.
Definition: error.h:116
add_detail_helper(boost::format &fmt, A const &value)
The constructor.
Definition: error.h:265
static std::string format_error(A const &context1, B const &context2, C const &context3, error_type error, D const &detail1, E const &detail2, F const &detail3)
Format an error message.
error_base(const std::string &error, const std::string &reason)
The constructor.
Definition: error.h:56
static const char * get_error(error_type error)
Get a translated error string.
add_detail_helper(boost::format &fmt, A const &value)
The constructor.
Definition: error.h:285
static void add_reason(std::string &reason, A const &value)
Add reason to reason string.
static std::string format_reason(A const &context1, B const &context2, C const &context3, R const &error, D const &detail1, E const &detail2, F const &detail3)
Format an reason string.