configure: enable -Wshadow-field
[babeltrace.git] / src / cpp-common / bt2 / lib-error.hpp
CommitLineData
1fdc674a
PP
1/*
2 * Copyright (c) 2020 Philippe Proulx <pproulx@efficios.com>
3 *
4 * SPDX-License-Identifier: MIT
5 */
6
7#ifndef BABELTRACE_CPP_COMMON_BT2_LIB_ERROR_HPP
8#define BABELTRACE_CPP_COMMON_BT2_LIB_ERROR_HPP
9
10#include <string>
11#include <stdexcept>
12
13namespace bt2 {
14
15/*
16 * Any library error.
17 */
18class LibError : public std::runtime_error
19{
20public:
21 explicit LibError(const std::string& msg = "Error") : std::runtime_error {msg}
22 {
23 }
24};
25
26/*
27 * Memory error.
28 */
29class LibMemoryError : public LibError
30{
31public:
32 LibMemoryError() : LibError {"Memory error"}
33 {
34 }
35};
36
37/*
38 * Overflow error.
39 */
40class LibOverflowError : public LibError
41{
42public:
43 LibOverflowError() : LibError {"Overflow error"}
44 {
45 }
46};
47
48} // namespace bt2
49
50#endif // BABELTRACE_CPP_COMMON_BT2_LIB_ERROR_HPP
This page took 0.051004 seconds and 4 git commands to generate.