Sha256: 7a1179f17c6b12e0d1ebcd89884b91c787d8ad225d49170f8714eca4eb6ee100

Contents?: true

Size: 1.23 KB

Versions: 2

Compression:

Stored size: 1.23 KB

Contents

/*
 * Summary: Exceptions for the C++ interface
 *
 * Copy: See Copyright for the status of this software.
 *
 */

/**
 * @file
 * @brief Exception declarations
 */

#ifndef LIBMEMACHED_EXCEPTION_HPP
#define LIBMEMACHED_EXCEPTION_HPP

#include <stdexcept>
#include <string>

namespace memcache 
{
  class Exception : public std::runtime_error
  {
  public:
    Exception(const std::string& msg, int in_errno)
      : 
        std::runtime_error(msg), 
        _errno(in_errno) 
    {}

    Exception(const char *msg, int in_errno)
      : 
        std::runtime_error(std::string(msg)), 
        _errno(in_errno) {}

    virtual ~Exception() throw() {}

    int getErrno() const 
    { 
      return _errno; 
    }

  private:
    int _errno;
  };

  class Warning : public Exception
  {
  public:
    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, 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 */

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
couchbase-memcached-1.2.9 ext/libmemcached-0.50/libmemcached/exception.hpp
couchbase-memcached-1.2.8 ext/libmemcached-0.50/libmemcached/exception.hpp