summaryrefslogtreecommitdiff
path: root/sbuild/sbuild-custom-error.h
diff options
context:
space:
mode:
authorRoger Leigh <rleigh@debian.org>2006-07-13 19:07:16 +0000
committerRoger Leigh <rleigh@debian.org>2006-07-13 19:07:16 +0000
commit0c9747705eb6a43a5a8c7d9bb5a4eb3f771d3063 (patch)
treec93ccdf5e59ef2ef3c303edee122edbb50c58ab8 /sbuild/sbuild-custom-error.h
parentb4aff3546d8e3f93d8595382e1736ec0fabc55ce (diff)
downloadschroot-0c9747705eb6a43a5a8c7d9bb5a4eb3f771d3063.tar.gz
* TODO: Remove completed error string markup item.
* Add boost::format markup to error strings. * sbuild/sbuild-custom-error.h: All constructor detail arguments are now templated. Add additional constructors for multiple detail arguments.
Diffstat (limited to 'sbuild/sbuild-custom-error.h')
-rw-r--r--sbuild/sbuild-custom-error.h65
1 files changed, 50 insertions, 15 deletions
diff --git a/sbuild/sbuild-custom-error.h b/sbuild/sbuild-custom-error.h
index 29d37e06..02c26e06 100644
--- a/sbuild/sbuild-custom-error.h
+++ b/sbuild/sbuild-custom-error.h
@@ -48,12 +48,13 @@ namespace sbuild
/**
* The constructor.
*
- * @param detail the details of the error.
+ * @param context the context of the error.
* @param error the error code.
*/
- custom_error (std::string const& detail,
+ template<typename C>
+ custom_error (C const& context,
error_type error):
- sbuild::error<T>(format_error(detail, null(), null(), error, null(), null()))
+ sbuild::error<T>(format_error(context, null(), null(), error, null(), null()))
{
}
@@ -61,32 +62,65 @@ namespace sbuild
* The constructor.
*
* @param error the error code.
- * @param error_string the error string.
+ * @param detail the details of the error.
*/
- custom_error (error_type error,
- std::string const& error_string):
- sbuild::error<T>(format_error(null(), null(), null(), error, error_string, null()))
+ template<typename D>
+ custom_error (error_type error,
+ D const& detail):
+ sbuild::error<T>(format_error(null(), null(), null(), error, detail, null()))
{
}
/**
* The constructor.
*
+ * @param error the error code.
* @param detail the details of the error.
+ * @param detail2 additional details of the error.
+ */
+ template<typename D, typename E>
+ custom_error (error_type error,
+ D const& detail,
+ E const& detail2):
+ sbuild::error<T>(format_error(null(), null(), null(), error, detail, detail2))
+ {
+ }
+
+ /**
+ * The constructor.
+ *
+ * @param context the context of the error.
* @param error the error code.
- * @param error_string the error string.
+ * @param detail the details of the error.
*/
- custom_error (std::string const& detail,
- error_type error,
- std::string const& error_string):
- sbuild::error<T>(format_error(detail, null(), null(), error, error_string, null()))
+ template<typename C, typename D>
+ custom_error (C const& context,
+ error_type error,
+ D const& detail):
+ sbuild::error<T>(format_error(context, null(), null(), error, detail, null()))
{
}
/**
* The constructor.
*
+ * @param context the context of the error.
+ * @param error the error code.
* @param detail the details of the error.
+ * @param detail2 additional details of the error.
+ */
+ template<typename C, typename D, typename E>
+ custom_error (C const& context,
+ error_type error,
+ D const& detail,
+ E const& detail2):
+ sbuild::error<T>(format_error(context, null(), null(), error, detail, detail2))
+ {
+ }
+
+ /**
+ * The constructor.
+ *
* @param error the error code.
*/
custom_error (std::runtime_error const& error):
@@ -97,12 +131,13 @@ namespace sbuild
/**
* The constructor.
*
- * @param detail the details of the error.
+ * @param context the context of the error.
* @param error the error code.
*/
- custom_error (std::string const& detail,
+ template<typename C>
+ custom_error (C const& context,
std::runtime_error const& error):
- sbuild::error<T>(format_error(detail, null(), null(), error, null(), null()))
+ sbuild::error<T>(format_error(context, null(), null(), error, null(), null()))
{
}