summaryrefslogtreecommitdiffstats
path: root/ext/yahttp/yahttp/exception.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'ext/yahttp/yahttp/exception.hpp')
-rw-r--r--ext/yahttp/yahttp/exception.hpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/ext/yahttp/yahttp/exception.hpp b/ext/yahttp/yahttp/exception.hpp
new file mode 100644
index 0000000..d0ea0fe
--- /dev/null
+++ b/ext/yahttp/yahttp/exception.hpp
@@ -0,0 +1,24 @@
+#pragma once
+#include <exception>
+
+namespace YaHTTP {
+ /*! Generic error class */
+ class Error: public std::exception {
+ public:
+ Error() {};
+ Error(const std::string& reason_): reason(reason_) {};
+ virtual ~Error() throw() {};
+
+ virtual const char* what() const throw()
+ {
+ return reason.c_str();
+ }
+ const std::string reason; //<! Cause of the error
+ };
+ /*! Parse error class */
+ class ParseError: public YaHTTP::Error {
+ public:
+ ParseError() {};
+ ParseError(const std::string& reason_): Error(reason_) {};
+ };
+};