PdCom  5.3
Process data communication client
Loading...
Searching...
No Matches
Exception.h
Go to the documentation of this file.
1/*****************************************************************************
2 *
3 * Copyright (C) 2021 Bjarne von Horn (vh at igh dot de).
4 *
5 * This file is part of the PdCom library.
6 *
7 * The PdCom library is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU Lesser General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or (at your
10 * option) any later version.
11 *
12 * The PdCom library is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
15 * License for more .
16 *
17 * You should have received a copy of the GNU Lesser General Public License
18 * along with the PdCom library. If not, see <http://www.gnu.org/licenses/>.
19 *
20 *****************************************************************************/
21
23
24#ifndef PDCOM5_EXCEPTION_H
25#define PDCOM5_EXCEPTION_H
26
27#include <pdcom5_export.h>
28#include <stdexcept>
29#include <string>
30
31namespace PdCom {
32
33struct PDCOM5_PUBLIC Exception : std::runtime_error
34{
35 using std::runtime_error::runtime_error;
36};
37
38struct PDCOM5_PUBLIC InternalError : Exception
39{
40 InternalError() : Exception("Internal error, please file a bug report") {}
41 InternalError(const std::string &msg) :
42 Exception("Internal error, please file a bug report: " + msg)
43 {}
44};
45
46struct PDCOM5_PUBLIC InvalidArgument : Exception
47{
48 using Exception::Exception;
49};
50
51struct PDCOM5_PUBLIC ConnectionFailed : Exception
52{
53 ConnectionFailed() : Exception("Connection failed") {}
54};
55
56struct PDCOM5_PUBLIC EmptyVariable : Exception
57{
58 EmptyVariable() : Exception("Variable is empty") {}
59};
60
61struct PDCOM5_PUBLIC InvalidSubscription : Exception
62{
63 InvalidSubscription() : Exception("invalid subscription") {}
64};
65
66struct PDCOM5_PUBLIC LoginRequired : Exception
67{
68 LoginRequired() : Exception("Login is required") {}
69};
70
71struct PDCOM5_PUBLIC NotConnected : Exception
72{
73 NotConnected() : Exception("Not connected") {}
74};
75
76struct PDCOM5_PUBLIC ProcessGoneAway : Exception
77{
78 ProcessGoneAway() : Exception("Process has gone away") {}
79};
80
81struct PDCOM5_PUBLIC ProtocolError : Exception
82{
83 using Exception::Exception;
84};
85
86struct PDCOM5_PUBLIC ReadFailure : Exception
87{
88 int errno_;
89 ReadFailure(int e) :
90 Exception("Read failure, errno: " + std::to_string(e)), errno_(e)
91 {}
92};
93
94struct PDCOM5_PUBLIC TlsError : Exception
95{
96 TlsError(std::string what, int err_code) :
97 Exception(std::move(what)), err_code_(err_code)
98 {}
99 int err_code_;
100};
101
102struct PDCOM5_PUBLIC WriteFailure : Exception
103{
104 int errno_;
105 using Exception::Exception;
106 WriteFailure(int e) :
107 Exception("Write failure, errno: " + std::to_string(e)), errno_(e)
108 {}
109};
110
111
112} // namespace PdCom
113
114
115#endif // PDCOM5_EXCEPTION_H
Definition Exception.h:34
Definition Exception.h:47
Definition Exception.h:82