MPD  0.20.23
Error.hxx
Go to the documentation of this file.
1 /*
2  * Copyright 2007-2017 Content Management AG
3  * All rights reserved.
4  *
5  * author: Max Kellermann <mk@cm4all.com>
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  *
11  * - Redistributions of source code must retain the above copyright
12  * notice, this list of conditions and the following disclaimer.
13  *
14  * - Redistributions in binary form must reproduce the above copyright
15  * notice, this list of conditions and the following disclaimer in the
16  * documentation and/or other materials provided with the
17  * distribution.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
22  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
23  * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
24  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
25  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
28  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
30  * OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
32 
33 #ifndef NFS_ERROR_HXX
34 #define NFS_ERROR_HXX
35 
36 #include <stdexcept>
37 
38 class NfsClientError : public std::runtime_error {
39  int code;
40 
41 public:
42  explicit NfsClientError(const char *_msg) noexcept
43  :std::runtime_error(_msg), code(0) {}
44 
45  NfsClientError(int _code, const char *_msg) noexcept
46  :std::runtime_error(_msg), code(_code) {}
47 
48  NfsClientError(struct nfs_context *nfs, const char *msg) noexcept;
49 
50  NfsClientError(int err, struct nfs_context *nfs, void *data,
51  const char *msg) noexcept;
52 
53  int GetCode() const noexcept {
54  return code;
55  }
56 };
57 
58 #endif
NfsClientError(int _code, const char *_msg) noexcept
Definition: Error.hxx:45
NfsClientError(const char *_msg) noexcept
Definition: Error.hxx:42
int GetCode() const noexcept
Definition: Error.hxx:53