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>(format_error(null(), null(), null(), error, null(), null()),
00045 format_reason(null(), null(), null(), error, null(), null()))
00046 {
00047 }
00048
00055 template<typename C>
00056 custom_error (C const& context,
00057 error_type error):
00058 sbuild::error<T>(format_error(context, null(), null(), error, null(), null()),
00059 format_reason(context, null(), null(), error, null(), null()))
00060 {
00061 }
00062
00069 template<typename D>
00070 custom_error (error_type error,
00071 D const& detail):
00072 sbuild::error<T>(format_error(null(), null(), null(), error, detail, null()),
00073 format_reason(null(), null(), null(), error, detail, 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>(format_error(null(), null(), null(), error, detail, detail2),
00089 format_reason(null(), null(), null(), error, detail, detail2))
00090 {
00091 }
00092
00100 template<typename C, typename D>
00101 custom_error (C const& context,
00102 error_type error,
00103 D const& detail):
00104 sbuild::error<T>(format_error(context, null(), null(), error, detail, null()),
00105 format_reason(context, null(), null(), error, detail, null()))
00106 {
00107 }
00108
00117 template<typename C, typename D, typename E>
00118 custom_error (C const& context,
00119 error_type error,
00120 D const& detail,
00121 E const& detail2):
00122 sbuild::error<T>(format_error(context, null(), null(), error, detail, detail2),
00123 format_reason(context, null(), null(), error, detail, detail2))
00124 {
00125 }
00126
00135 template<typename C, typename D, typename E>
00136 custom_error (C const& context1,
00137 D const& context2,
00138 error_type error,
00139 E const& detail):
00140 sbuild::error<T>(format_error(context1, context2, null(), error, detail, null()),
00141 format_reason(context1, context2, null(), error, detail, null()))
00142 {
00143 }
00144
00154 template<typename C, typename D, typename E, typename F>
00155 custom_error (C const& context1,
00156 D const& context2,
00157 error_type error,
00158 E const& detail,
00159 F const& detail2):
00160 sbuild::error<T>(format_error(context1, context2, null(), error, detail, detail2),
00161 format_reason(context1, context2, null(), error, detail, detail2))
00162 {
00163 }
00164
00170 custom_error (std::runtime_error const& error):
00171 sbuild::error<T>(sbuild::error<T>::format_error(null(), null(), null(), error, null(), null()),
00172 sbuild::error<T>::format_reason(null(), null(), null(), error, null(), null()))
00173 {
00174 }
00175
00181 custom_error (error_base const& error):
00182 sbuild::error<T>(sbuild::error<T>::format_error(null(), null(), null(), error, null(), null()),
00183 sbuild::error<T>::format_reason(null(), null(), null(), error, null(), null()))
00184 {
00185 }
00186
00193 template<typename C>
00194 custom_error (C const& context,
00195 std::runtime_error const& error):
00196 sbuild::error<T>(sbuild::error<T>::format_error(context, null(), null(), error, null(), null()),
00197 sbuild::error<T>::format_reason(context, null(), null(), error, null(), null()))
00198 {
00199 }
00200
00207 template<typename C>
00208 custom_error (C const& context,
00209 error_base const& error):
00210 sbuild::error<T>(sbuild::error<T>::format_error(context, null(), null(), error, null(), null()),
00211 sbuild::error<T>::format_reason(context, null(), null(), error, null(), null()))
00212 {
00213 }
00214
00216 virtual ~custom_error () throw ()
00217 {}
00218 };
00219
00220 }
00221
00222 #endif
00223
00224
00225
00226
00227
00228