/src/pdns/ext/yahttp/yahttp/exception.hpp
Line | Count | Source |
1 | | #pragma once |
2 | | #include <exception> |
3 | | |
4 | | namespace YaHTTP { |
5 | | /*! Generic error class */ |
6 | | class Error: public std::exception { |
7 | | public: |
8 | 0 | Error() {}; |
9 | 314 | Error(const std::string& reason_): reason(reason_) {}; |
10 | 314 | virtual ~Error() throw() {}; |
11 | | |
12 | | virtual const char* what() const throw() |
13 | 0 | { |
14 | 0 | return reason.c_str(); |
15 | 0 | } |
16 | | const std::string reason; //<! Cause of the error |
17 | | }; |
18 | | /*! Parse error class */ |
19 | | class ParseError: public YaHTTP::Error { |
20 | | public: |
21 | 0 | ParseError() {}; |
22 | 314 | ParseError(const std::string& reason_): Error(reason_) {}; |
23 | | }; |
24 | | }; |