19 #ifndef SBUILD_ERROR_H
20 #define SBUILD_ERROR_H
27 #include <boost/format.hpp>
28 #include <boost/type_traits.hpp>
57 std::string
const&
reason):
76 return this->
reason.c_str();
109 template <
typename T>
116 typedef std::map<error_type,const char *>
map_type;
135 std::string
const&
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 std::runtime_error
const&
error,
219 template <
typename A,
typename B,
typename C,
220 typename R,
typename D,
typename E,
typename F>
245 template<
typename A,
bool b>
296 template<
typename A,
bool b>
334 catch (std::bad_cast
const& discard)
344 #include "sbuild-error.tcc"
Helper class to add detail to format string.
Definition: sbuild-error.h:246
Helper class to add reason to reason string.
Definition: sbuild-error.h:297
static map_type error_strings
Mapping between error code and string.
Definition: sbuild-error.h:146
add_reason_helper(std::string &reason, A const &value)
The constructor.
Definition: sbuild-error.h:305
Debian source builder components.
Definition: sbuild-auth-null.h:24
void set_reason(std::string const &reason)
Set the reason for the error.
Definition: sbuild-error.h:96
T error_type
The enum type providing the error codes for this type.
Definition: sbuild-error.h:114
virtual const char * why() const
Get the reason for the error.
Definition: sbuild-error.h:74
virtual ~error_base()
The destructor.
Definition: sbuild-error.h:65
std::string const & get_reason() const
Get the reason for the error.
Definition: sbuild-error.h:85
error_base(std::string const &error)
The constructor.
Definition: sbuild-error.h:44
add_reason_helper(std::string &reason, A const &value)
The constructor.
Definition: sbuild-error.h:324
Error exception base class.
Definition: sbuild-error.h:36
std::string reason
The reason for the error.
Definition: sbuild-error.h:103
Error exception class.
Definition: sbuild-error.h:110
error(std::string const &error, std::string const &reason)
The constructor.
Definition: sbuild-error.h:134
virtual ~error()
The destructor.
Definition: sbuild-error.h:141
std::map< error_type, const char * > map_type
Mapping between error code and error description.
Definition: sbuild-error.h:116
add_detail_helper(boost::format &fmt, A const &value)
The constructor.
Definition: sbuild-error.h:254
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(std::string const &error, std::string const &reason)
The constructor.
Definition: sbuild-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: sbuild-error.h:274
error(std::string const &error)
The constructor.
Definition: sbuild-error.h:123
static void add_detail(boost::format &fmt, A const &value)
Add detail to format string.
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.