00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef SBUILD_CUSTOM_ERROR_H
00020 #define SBUILD_CUSTOM_ERROR_H
00021
00022 #include <sbuild/sbuild-error.h>
00023 #include <sbuild/sbuild-null.h>
00024
00025 namespace sbuild
00026 {
00027
00031 template <typename T>
00032 class custom_error : public error<T>
00033 {
00034 public:
00036 typedef typename error<T>::error_type error_type;
00037
00043 custom_error (error_type error):
00044 sbuild::error<T>(this->format_error(null(), null(), null(), error, null(), null(), null()),
00045 this->format_reason(null(), null(), null(), error, null(), null(), null()))
00046 {
00047 }
00048
00055 template<typename C>
00056 custom_error (C const& context,
00057 error_type error):
00058 sbuild::error<T>(this->format_error(context, null(), null(), error, null(), null(), null()),
00059 this->format_reason(context, null(), null(), error, null(), null(), null()))
00060 {
00061 }
00062
00069 template<typename D>
00070 custom_error (error_type error,
00071 D const& detail):
00072 sbuild::error<T>(this->format_error(null(), null(), null(), error, detail, null(), null()),
00073 this->format_reason(null(), null(), null(), error, detail, null(), null()))
00074 {
00075 }
00076
00084 template<typename D, typename E>
00085 custom_error (error_type error,
00086 D const& detail,
00087 E const& detail2):
00088 sbuild::error<T>(this->format_error(null(), null(), null(), error, detail, detail2, null()),
00089 this->format_reason(null(), null(), null(), error, detail, detail2, null()))
00090 {
00091 }
00092
00101 template<typename D, typename E, typename F>
00102 custom_error (error_type error,
00103 D const& detail,
00104 E const& detail2,
00105 F const& detail3):
00106 sbuild::error<T>(this->format_error(null(), null(), null(), error, detail, detail2, detail3),
00107 this->format_reason(null(), null(), null(), error, detail, detail2, detail3))
00108 {
00109 }
00110
00118 template<typename C, typename D>
00119 custom_error (C const& context,
00120 error_type error,
00121 D const& detail):
00122 sbuild::error<T>(this->format_error(context, null(), null(), error, detail, null(), null()),
00123 this->format_reason(context, null(), null(), error, detail, null(), null()))
00124 {
00125 }
00126
00135 template<typename C, typename D, typename E>
00136 custom_error (C const& context,
00137 error_type error,
00138 D const& detail,
00139 E const& detail2):
00140 sbuild::error<T>(format_error(context, null(), null(), error, detail, detail2, null()),
00141 format_reason(context, null(), null(), error, detail, detail2, null()))
00142 {
00143 }
00144
00153 template<typename C, typename D, typename E>
00154 custom_error (C const& context1,
00155 D const& context2,
00156 error_type error,
00157 E const& detail):
00158 sbuild::error<T>(this->format_error(context1, context2, null(), error, detail, null(), null()),
00159 this->format_reason(context1, context2, null(), error, detail, null(), null()))
00160 {
00161 }
00162
00172 template<typename C, typename D, typename E, typename F>
00173 custom_error (C const& context1,
00174 D const& context2,
00175 error_type error,
00176 E const& detail,
00177 F const& detail2):
00178 sbuild::error<T>(format_error(context1, context2, null(), error, detail, detail2, null()),
00179 format_reason(context1, context2, null(), error, detail, detail2, null()))
00180 {
00181 }
00182
00188 custom_error (std::runtime_error const& error):
00189 sbuild::error<T>(sbuild::error<T>::format_error(null(), null(), null(), error, null(), null(), null()),
00190 sbuild::error<T>::format_reason(null(), null(), null(), error, null(), null(), null()))
00191 {
00192 }
00193
00199 custom_error (error_base const& error):
00200 sbuild::error<T>(sbuild::error<T>::format_error(null(), null(), null(), error, null(), null(), null()),
00201 sbuild::error<T>::format_reason(null(), null(), null(), error, null(), null(), null()))
00202 {
00203 }
00204
00211 template<typename C>
00212 custom_error (C const& context,
00213 std::runtime_error const& error):
00214 sbuild::error<T>(sbuild::error<T>::format_error(context, null(), null(), error, null(), null(), null()),
00215 sbuild::error<T>::format_reason(context, null(), null(), error, null(), null(), null()))
00216 {
00217 }
00218
00225 template<typename C>
00226 custom_error (C const& context,
00227 error_base const& error):
00228 sbuild::error<T>(sbuild::error<T>::format_error(context, null(), null(), error, null(), null(), null()),
00229 sbuild::error<T>::format_reason(context, null(), null(), error, null(), null(), null()))
00230 {
00231 }
00232
00234 virtual ~custom_error () throw ()
00235 {}
00236 };
00237
00238 }
00239
00240 #endif
00241
00242
00243
00244
00245
00246