ci: bsds: rebuild packages after reconfiguration
[m6w6/libmemcached] / include / libmemcached-1.0 / exception.hpp
1 /*
2 +--------------------------------------------------------------------+
3 | libmemcached - C/C++ Client Library for memcached |
4 +--------------------------------------------------------------------+
5 | Redistribution and use in source and binary forms, with or without |
6 | modification, are permitted under the terms of the BSD license. |
7 | You should have received a copy of the license in a bundled file |
8 | named LICENSE; in case you did not receive a copy you can review |
9 | the terms online at: https://opensource.org/licenses/BSD-3-Clause |
10 +--------------------------------------------------------------------+
11 | Copyright (c) 2006-2014 Brian Aker https://datadifferential.com/ |
12 | Copyright (c) 2020 Michael Wallner <mike@php.net> |
13 +--------------------------------------------------------------------+
14 */
15
16 #pragma once
17
18 #include <stdexcept>
19 #include <string>
20
21 namespace memcache {
22 class Exception : public std::runtime_error {
23 public:
24 Exception(const std::string &msg, int in_errno)
25 : std::runtime_error(msg)
26 , _errno(in_errno) {}
27
28 Exception(const char *msg, int in_errno)
29 : std::runtime_error(std::string(msg))
30 , _errno(in_errno) {}
31
32 virtual ~Exception() throw() {}
33
34 int getErrno() const { return _errno; }
35
36 private:
37 int _errno;
38 };
39
40 class Warning : public Exception {
41 public:
42 Warning(const std::string &msg, int in_errno)
43 : Exception(msg, in_errno) {}
44 Warning(const char *msg, int in_errno)
45 : Exception(msg, in_errno) {}
46 };
47
48 class Error : public Exception {
49 public:
50 Error(const std::string &msg, int in_errno)
51 : Exception(msg, in_errno) {}
52 Error(const char *msg, int in_errno)
53 : Exception(msg, in_errno) {}
54 virtual ~Error() throw() {}
55 };
56
57 } // namespace memcache