summaryrefslogtreecommitdiff
path: root/src/voltronic/exceptions.h
blob: bae442626f2fcd7ab13c7939456d84aa1785af60 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// SPDX-License-Identifier: BSD-3-Clause

#ifndef INVERTER_TOOLS_VOLTRONIC_EXCEPTIONS_H
#define INVERTER_TOOLS_VOLTRONIC_EXCEPTIONS_H

#include <stdexcept>

namespace voltronic {

// ----------
// exceptions
// ----------

class DeviceError : public std::runtime_error {
public:
    using std::runtime_error::runtime_error;
};

class TimeoutError : public std::runtime_error {
public:
    using std::runtime_error::runtime_error;
};

class InvalidDataError : public std::runtime_error {
public:
    using std::runtime_error::runtime_error;
};

class OverflowError : public std::overflow_error {
public:
    using std::overflow_error::overflow_error;
};


// ---------------
// exception types
// ---------------

enum class ErrorType {
    None = 0,
    DeviceError,
    TimeoutError,
    InvalidDataError,
    OverflowError,
};

}

#endif //INVERTER_TOOLS_VOLTRONIC_EXCEPTIONS_H