summaryrefslogtreecommitdiffstats
path: root/ext/yahttp/yahttp/exception.hpp
blob: d0ea0fea2dbb36f7835fd814f1e4f3164a2e7555 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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_) {};
  };
};