summaryrefslogtreecommitdiffabout
path: root/include/sitecing/exception.h
authorMichael Krelin <hacker@klever.net>2005-01-29 21:21:05 (UTC)
committer Michael Krelin <hacker@klever.net>2005-01-29 21:21:05 (UTC)
commitce1f37aae46ea95020d7b865f7a80e8abdfad0d8 (patch) (side-by-side diff)
tree4964383ab8cd7e6d8ea821f1a615d1bbcf98dad8 /include/sitecing/exception.h
parent3c75c860fc1ad5b3f5185e23ec6f438dd2528958 (diff)
downloadsitecing-ce1f37aae46ea95020d7b865f7a80e8abdfad0d8.zip
sitecing-ce1f37aae46ea95020d7b865f7a80e8abdfad0d8.tar.gz
sitecing-ce1f37aae46ea95020d7b865f7a80e8abdfad0d8.tar.bz2
initial commit into repository0.0
Diffstat (limited to 'include/sitecing/exception.h') (more/less context) (ignore whitespace changes)
-rw-r--r--include/sitecing/exception.h542
1 files changed, 542 insertions, 0 deletions
diff --git a/include/sitecing/exception.h b/include/sitecing/exception.h
new file mode 100644
index 0000000..985fc6d
--- a/dev/null
+++ b/include/sitecing/exception.h
@@ -0,0 +1,542 @@
+#ifndef __SITECING_EXCEPTION_H
+#define __SITECING_EXCEPTION_H
+
+/**
+ * @file
+ * @brief The site-C-ing specific exceptions.
+ */
+
+/**
+ * @brief The main site-C-ing namespace.
+ */
+namespace sitecing {
+
+ // TODO: status specifics
+
+ /**
+ * The http status to return.
+ */
+ class http_status {
+ public:
+ /**
+ * The status string.
+ */
+ string status;
+ /**
+ * The message to follow the status string.
+ */
+ string message;
+
+ /**
+ * @param s HTTP status.
+ * @param m HTTP status message.
+ */
+ http_status(const string& s,const string& m)
+ : status(s), message(m) { }
+ virtual ~http_status() throw() { }
+ };
+
+ // per RFC 2616
+
+ /**
+ * Informational.
+ */
+ class http_status_1xx : public http_status {
+ public:
+ explicit http_status_1xx(const string &s,const string& m)
+ : http_status(s,m) { }
+ };
+ /**
+ * Continue.
+ */
+ class http_status_100 : public http_status_1xx {
+ public:
+ explicit http_status_100(const string& m)
+ : http_status_1xx("100",m) { }
+ explicit http_status_100()
+ : http_status_1xx("100","Continue") { }
+ };
+ /**
+ * Switching protocols.
+ */
+ class http_status_101 : public http_status_1xx {
+ public:
+ explicit http_status_101(const string& m)
+ : http_status_1xx("101",m) { }
+ explicit http_status_101()
+ : http_status_1xx("101","Switching protocols") { }
+ };
+
+ /**
+ * Successful.
+ */
+ class http_status_2xx : public http_status {
+ public:
+ explicit http_status_2xx(const string& s,const string& m)
+ : http_status(s,m) { }
+ };
+ /**
+ * OK.
+ */
+ class http_status_200 : public http_status_2xx {
+ public:
+ explicit http_status_200(const string& m)
+ : http_status_2xx("200",m) { }
+ explicit http_status_200()
+ : http_status_2xx("200","OK") { }
+ };
+ /**
+ * Created.
+ */
+ class http_status_201 : public http_status_2xx {
+ public:
+ explicit http_status_201(const string& m)
+ : http_status_2xx("201",m) { }
+ explicit http_status_201()
+ : http_status_2xx("201","Created") { }
+ };
+ /**
+ * Accepted.
+ */
+ class http_status_202 : public http_status_2xx {
+ public:
+ explicit http_status_202(const string& m)
+ : http_status_2xx("202",m) { }
+ explicit http_status_202()
+ : http_status_2xx("202","Accepted") { }
+ };
+ /**
+ * Non-authoritative infortmation.
+ */
+ class http_status_203 : public http_status_2xx {
+ public:
+ explicit http_status_203(const string& m)
+ : http_status_2xx("203",m) { }
+ explicit http_status_203()
+ : http_status_2xx("203","Non-authoritative information") { }
+ };
+ /**
+ * No content.
+ */
+ class http_status_204 : public http_status_2xx {
+ public:
+ explicit http_status_204(const string& m)
+ : http_status_2xx("204",m) { }
+ explicit http_status_204()
+ : http_status_2xx("204","No content") { }
+ };
+ /**
+ * Reset content.
+ */
+ class http_status_205 : public http_status_2xx {
+ public:
+ explicit http_status_205(const string& m)
+ : http_status_2xx("205",m) { }
+ explicit http_status_205()
+ : http_status_2xx("205","Reset content") { }
+ };
+ /**
+ * Partial content.
+ */
+ class http_status_206 : public http_status_2xx {
+ public:
+ explicit http_status_206(const string& m)
+ : http_status_2xx("206",m) { }
+ explicit http_status_206()
+ : http_status_2xx("206","Partial content") { }
+ };
+
+ /**
+ * Redirection.
+ */
+ class http_status_3xx : public http_status {
+ public:
+ explicit http_status_3xx(const string& s,const string& m)
+ : http_status(s,m) { }
+ };
+ /**
+ * Multiple choices.
+ */
+ class http_status_300 : public http_status_3xx {
+ public:
+ explicit http_status_300(const string& m)
+ : http_status_3xx("300",m) { }
+ explicit http_status_300()
+ : http_status_3xx("300","Multiple choices") { }
+ };
+ /**
+ * Moved permanently.
+ */
+ class http_status_301 : public http_status_3xx {
+ public:
+ explicit http_status_301(const string& m)
+ : http_status_3xx("301",m) { }
+ explicit http_status_301()
+ : http_status_3xx("301","Moved permanently") { }
+ };
+ /**
+ * Found.
+ */
+ class http_status_302 : public http_status_3xx {
+ public:
+ explicit http_status_302(const string& m)
+ : http_status_3xx("302",m) { }
+ explicit http_status_302()
+ : http_status_3xx("302","Found") { }
+ };
+ /**
+ * See other.
+ */
+ class http_status_303 : public http_status_3xx {
+ public:
+ explicit http_status_303(const string& m)
+ : http_status_3xx("303",m) { }
+ explicit http_status_303()
+ : http_status_3xx("303","See other") { }
+ };
+ /**
+ * Not modified.
+ */
+ class http_status_304 : public http_status_3xx {
+ public:
+ explicit http_status_304(const string& m)
+ : http_status_3xx("304",m) { }
+ explicit http_status_304()
+ : http_status_3xx("304","Not modified") { }
+ };
+ /**
+ * Use proxy.
+ */
+ class http_status_305 : public http_status_3xx {
+ public:
+ explicit http_status_305(const string& m)
+ : http_status_3xx("305",m) { }
+ explicit http_status_305()
+ : http_status_3xx("305","Use proxy") { }
+ };
+ // 306 is unused and reserved
+ /**
+ * Temporary redirect.
+ */
+ class http_status_307 : public http_status_3xx {
+ public:
+ explicit http_status_307(const string& m)
+ : http_status_3xx("307",m) { }
+ explicit http_status_307()
+ : http_status_3xx("307","Temporary redirect") { }
+ };
+
+ /**
+ * Error.
+ */
+ class http_status_4xx : public http_status {
+ public:
+ explicit http_status_4xx(const string& s,const string& m)
+ : http_status(s,m) { }
+ };
+ /**
+ * Bad request.
+ */
+ class http_status_400 : public http_status_4xx {
+ public:
+ explicit http_status_400(const string& m)
+ : http_status_4xx("400",m) { }
+ explicit http_status_400()
+ : http_status_4xx("400","Bad request") { }
+ };
+ /**
+ * Unauthorized.
+ */
+ class http_status_401 : public http_status_4xx {
+ public:
+ explicit http_status_401(const string& m)
+ : http_status_4xx("401",m) { }
+ explicit http_status_401()
+ : http_status_4xx("401","Unauthorized") { }
+ };
+ /**
+ * Payment required.
+ */
+ class http_status_402 : public http_status_4xx {
+ public:
+ explicit http_status_402(const string& m)
+ : http_status_4xx("402",m) { }
+ explicit http_status_402()
+ : http_status_4xx("402","Payment required") { }
+ };
+ /**
+ * Forbidden.
+ */
+ class http_status_403 : public http_status_4xx {
+ public:
+ explicit http_status_403(const string& m)
+ : http_status_4xx("403",m) { }
+ explicit http_status_403()
+ : http_status_4xx("403","Forbidden") { }
+ };
+ /**
+ * Not found.
+ */
+ class http_status_404 : public http_status_4xx {
+ public:
+ explicit http_status_404(const string& m)
+ : http_status_4xx("404",m) { }
+ explicit http_status_404()
+ : http_status_4xx("404","Not found") { }
+ };
+ /**
+ * Method not allowed.
+ */
+ class http_status_405 : public http_status_4xx {
+ public:
+ explicit http_status_405(const string& m)
+ : http_status_4xx("405",m) { }
+ explicit http_status_405()
+ : http_status_4xx("405","Method not allowed") { }
+ };
+ /**
+ * Not acceptable.
+ */
+ class http_status_406 : public http_status_4xx {
+ public:
+ explicit http_status_406(const string& m)
+ : http_status_4xx("406",m) { }
+ explicit http_status_406()
+ : http_status_4xx("406","Not acceptable") { }
+ };
+ /**
+ * Proxy authentication required.
+ */
+ class http_status_407 : public http_status_4xx {
+ public:
+ explicit http_status_407(const string& m)
+ : http_status_4xx("407",m) { }
+ explicit http_status_407()
+ : http_status_4xx("407","Proxy authentication required") { }
+ };
+ /**
+ * Request timeout.
+ */
+ class http_status_408 : public http_status_4xx {
+ public:
+ explicit http_status_408(const string& m)
+ : http_status_4xx("408",m) { }
+ explicit http_status_408()
+ : http_status_4xx("408","Request timeout") { }
+ };
+ /**
+ * Conflict.
+ */
+ class http_status_409 : public http_status_4xx {
+ public:
+ explicit http_status_409(const string& m)
+ : http_status_4xx("409",m) { }
+ explicit http_status_409()
+ : http_status_4xx("409","Conflict") { }
+ };
+ /**
+ * Gone.
+ */
+ class http_status_410 : public http_status_4xx {
+ public:
+ explicit http_status_410(const string& m)
+ : http_status_4xx("410",m) { }
+ explicit http_status_410()
+ : http_status_4xx("410","Gone") { }
+ };
+ /**
+ * Length required.
+ */
+ class http_status_411 : public http_status_4xx {
+ public:
+ explicit http_status_411(const string& m)
+ : http_status_4xx("411",m) { }
+ explicit http_status_411()
+ : http_status_4xx("411","Length required") { }
+ };
+ /**
+ * Precondition failed.
+ */
+ class http_status_412 : public http_status_4xx {
+ public:
+ explicit http_status_412(const string& m)
+ : http_status_4xx("412",m) { }
+ explicit http_status_412()
+ : http_status_4xx("412","Precondition failed") { }
+ };
+ /**
+ * Request entity too large.
+ */
+ class http_status_413 : public http_status_4xx {
+ public:
+ explicit http_status_413(const string& m)
+ : http_status_4xx("413",m) { }
+ explicit http_status_413()
+ : http_status_4xx("413","Request entity too large") { }
+ };
+ /**
+ * Request URI too long.
+ */
+ class http_status_414 : public http_status_4xx {
+ public:
+ explicit http_status_414(const string& m)
+ : http_status_4xx("414",m) { }
+ explicit http_status_414()
+ : http_status_4xx("414","Request URI too long") { }
+ };
+ /**
+ * Unsupported media type.
+ */
+ class http_status_415 : public http_status_4xx {
+ public:
+ explicit http_status_415(const string& m)
+ : http_status_4xx("415",m) { }
+ explicit http_status_415()
+ : http_status_4xx("415","Unsupported media type") { }
+ };
+ /**
+ * Requested range not satisfiable.
+ */
+ class http_status_416 : public http_status_4xx {
+ public:
+ explicit http_status_416(const string& m)
+ : http_status_4xx("416",m) { }
+ explicit http_status_416()
+ : http_status_4xx("416","Requested range not satisfiable") { }
+ };
+ /**
+ * Expectation failed.
+ */
+ class http_status_417 : public http_status_4xx {
+ public:
+ explicit http_status_417(const string& m)
+ : http_status_4xx("417",m) { }
+ explicit http_status_417()
+ : http_status_4xx("417","Expectation failed") { }
+ };
+
+ /**
+ * Server error.
+ */
+ class http_status_5xx : public http_status {
+ public:
+ explicit http_status_5xx(const string& s,const string& m)
+ : http_status(s,m) { }
+ };
+ /**
+ * Internal server error.
+ */
+ class http_status_500 : public http_status_5xx {
+ public:
+ explicit http_status_500(const string& m)
+ : http_status_5xx("500",m) { }
+ explicit http_status_500()
+ : http_status_5xx("500","Internal server error") { }
+ };
+ /**
+ * Not implemented.
+ */
+ class http_status_501 : public http_status_5xx {
+ public:
+ explicit http_status_501(const string& m)
+ : http_status_5xx("501",m) { }
+ explicit http_status_501()
+ : http_status_5xx("501","Not implemented") { }
+ };
+ /**
+ * Bad gateway.
+ */
+ class http_status_502 : public http_status_5xx {
+ public:
+ explicit http_status_502(const string& m)
+ : http_status_5xx("502",m) { }
+ explicit http_status_502()
+ : http_status_5xx("502","Bad gateway") { }
+ };
+ /**
+ * Service unavailable.
+ */
+ class http_status_503 : public http_status_5xx {
+ public:
+ explicit http_status_503(const string& m)
+ : http_status_5xx("503",m) { }
+ explicit http_status_503()
+ : http_status_5xx("503","Service unavailable") { }
+ };
+ /**
+ * Gateway timeout.
+ */
+ class http_status_504 : public http_status_5xx {
+ public:
+ explicit http_status_504(const string& m)
+ : http_status_5xx("504",m) { }
+ explicit http_status_504()
+ : http_status_5xx("504","Gateway timeout") { }
+ };
+ /**
+ * HTTP version not supported.
+ */
+ class http_status_505 : public http_status_5xx {
+ public:
+ explicit http_status_505(const string& m)
+ : http_status_5xx("505",m) { }
+ explicit http_status_505()
+ : http_status_5xx("505","HTTP version not supported") { }
+ };
+
+ // Aliases
+
+ typedef http_status_1xx http_status_informational;
+ typedef http_status_100 http_status_continue;
+ typedef http_status_101 http_status_switching_protocols;
+
+ typedef http_status_2xx http_status_sucessful;
+ typedef http_status_200 http_status_ok;
+ typedef http_status_201 http_status_created;
+ typedef http_status_202 http_status_accepted;
+ typedef http_status_203 http_status_non_authoritative_information;
+ typedef http_status_204 http_status_no_content;
+ typedef http_status_205 http_status_reset_content;
+ typedef http_status_206 http_status_partial_content;
+
+ typedef http_status_3xx http_status_redirection;
+ typedef http_status_300 http_status_multiple_choices;
+ typedef http_status_301 http_status_moved_permanently;
+ typedef http_status_302 http_status_found;
+ typedef http_status_303 http_status_see_other;
+ typedef http_status_304 http_status_not_modified;
+ typedef http_status_305 http_status_use_proxy;
+ // 306 is unused and reserved
+ typedef http_status_307 http_status_temporary_redirect;
+
+ typedef http_status_4xx http_status_client_error;
+ typedef http_status_400 http_status_bad_request;
+ typedef http_status_401 http_status_unauthorized;
+ typedef http_status_402 http_status_payment_required;
+ typedef http_status_403 http_status_forbidden;
+ typedef http_status_404 http_status_not_found;
+ typedef http_status_405 http_status_method_not_allowed;
+ typedef http_status_406 http_status_not_acceptable;
+ typedef http_status_407 http_status_proxy_authentication_required;
+ typedef http_status_408 http_status_request_timeout;
+ typedef http_status_409 http_status_conflict;
+ typedef http_status_410 http_status_gone;
+ typedef http_status_411 http_status_length_required;
+ typedef http_status_412 http_status_precondition_failed;
+ typedef http_status_413 http_status_request_entity_too_large;
+ typedef http_status_414 http_status_requrest_uri_too_long;
+ typedef http_status_415 http_status_unsupported_media_type;
+ typedef http_status_416 http_status_required_range_not_satisfiable;
+ typedef http_status_417 http_status_expectation_failed;
+
+ typedef http_status_5xx http_status_server_error;
+ typedef http_status_500 http_status_internal_server_error;
+ typedef http_status_501 http_status_not_implemented;
+ typedef http_status_502 http_status_bad_gateway;
+ typedef http_status_503 http_status_service_unavailable;
+ typedef http_status_504 http_status_gateway_timeout;
+ typedef http_status_505 http_status_http_version_not_supported;
+
+}
+
+#endif /* __SITECING_EXCEPTION_H */