telebotxx/include/telebotxx/Exception.hpp
2016-09-26 23:07:14 +03:00

36 lines
535 B
C++

#ifndef TELEBOTXX_EXCEPTION_HPP
#define TELEBOTXX_EXCEPTION_HPP
#include <stdexcept>
namespace telebotxx
{
class ParseError : public std::invalid_argument
{
public:
ParseError(const std::string& message)
: std::invalid_argument(message)
{
}
};
class ApiError : public std::runtime_error
{
public:
ApiError(int code, const std::string& message)
: std::runtime_error(message), code_(code)
{
}
int getCode() const
{
return code_;
}
protected:
int code_;
};
}
#endif // TELEBOTXX_EXCEPTION_HPP