X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=libmemcached%2Fexception.hpp;h=4759072abdd758445e47674f37ef52cd9f151835;hb=f6b72b6bdea4e92384570f6bfc088834b5223bde;hp=963f383588f52919b7515204d6198606170d50d3;hpb=ab40ca3627fc4f5fe7a020a92fcdb925e108a7af;p=m6w6%2Flibmemcached diff --git a/libmemcached/exception.hpp b/libmemcached/exception.hpp index 963f3835..4759072a 100644 --- a/libmemcached/exception.hpp +++ b/libmemcached/exception.hpp @@ -10,54 +10,51 @@ * @brief Exception declarations */ -#ifndef LIBMEMACHED_EXCEPTION_HPP -#define LIBMEMACHED_EXCEPTION_HPP +#pragma once #include - +#include namespace memcache { class Exception : public std::runtime_error { public: - Exception(const std::string& msg, bool in_errno) + Exception(const std::string& msg, int in_errno) : std::runtime_error(msg), - errno(in_errno) + _errno(in_errno) {} - Exception(const char *msg, bool in_errno) + Exception(const char *msg, int in_errno) : - std::runtime_error(msg), - errno(in_errno) {} + std::runtime_error(std::string(msg)), + _errno(in_errno) {} virtual ~Exception() throw() {} int getErrno() const { - return errno; + return _errno; } private: - int errno; + int _errno; }; class Warning : public Exception { public: - Warning(const std::string& msg, bool in_errno) : Exception(msg, in_errno) {} - Warning(const char *msg, bool in_errno) : Exception(msg, in_errno) {} + Warning(const std::string& msg, int in_errno) : Exception(msg, in_errno) {} + Warning(const char *msg, int in_errno) : Exception(msg, in_errno) {} }; class Error : public Exception { public: - Error(const std::string& msg, bool in_errno) : Exception(msg, in_errno) {} - Error(const char *msg, bool in_errno) : Exception(msg, in_errno) {} + Error(const std::string& msg, int in_errno) : Exception(msg, in_errno) {} + Error(const char *msg, int in_errno) : Exception(msg, in_errno) {} virtual ~Error() throw() {} }; } /* namespace libmemcached */ - -#endif /* LIBMEMACHED_EXCEPTION_HPP */