libsaltpack
Loading...
Searching...
No Matches
SaltpackException.h
1/*
2 * Copyright 2016-2024 Luca Zanconato
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#ifndef SALTPACK_SALTPACKEXCEPTION_H
18#define SALTPACK_SALTPACKEXCEPTION_H
19
20#include <iostream>
21
22namespace saltpack {
23
27 class SaltpackException : public std::exception {
28 std::runtime_error m;
29
30 public:
31 explicit SaltpackException(const std::string &msg) : m(msg.c_str()) {}
32
33 ~SaltpackException() noexcept override = default;
34
35 const char *what() const noexcept override {
36 return m.what();
37 }
38 };
39
40 static_assert(std::is_nothrow_copy_constructible<SaltpackException>::value,
41 "SaltpackException must be nothrow copy constructible");
42}
43
44#endif //SALTPACK_SALTPACKEXCEPTION_H
Saltpack exception.
Definition SaltpackException.h:27
The saltpack library namespace.
Definition ArmoredInputStream.h:24