12345678910111213141516171819202122232425262728293031 |
- #ifndef _FY_ERRORS_HPP_
- #define _FY_ERRORS_HPP_
- #include <string>
- namespace base {
- class error {
- public:
- error(const std::string& what):what_(what.c_str()) {
- }
- std::string what() const {
- return what_;
- }
- bool operator!=(const error& e) const {
- return e.what_.compare(what_) != 0;
- }
- bool operator==(const error& e) const {
- return e.what_.compare(what_) == 0;
- }
- private:
- std::string what_;
- };
- } /* namespace fy */
- #define nil base::error("nil")
- #define error_timeout base::error("timeout")
- #endif /* _FY_ERRORS_HPP_ */
|