-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexceptions.h
77 lines (65 loc) · 2.43 KB
/
exceptions.h
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
// gamma-viewer-3d - 3d visualization of sessions generated by gamma-analyzer
// Copyright (C) 2017 Dag Robole
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef EXCEPTIONS_H
#define EXCEPTIONS_H
#include <stdexcept>
#include <QString>
struct Exception : public std::runtime_error
{
explicit Exception(QString arg) noexcept
: std::runtime_error(arg.toStdString()) {}
};
struct Exception_IndexOutOfBounds : public Exception
{
explicit Exception_IndexOutOfBounds(QString source) noexcept
: Exception("Index out of bounds: " + source) {}
};
struct Exception_NumericRangeError : public Exception
{
explicit Exception_NumericRangeError(QString source) noexcept
: Exception("Numeric range error: " + source) {}
};
struct Exception_InvalidPointer : public Exception
{
explicit Exception_InvalidPointer(QString source) noexcept
: Exception("Invalid pointer: " + source) {}
};
struct Exception_DirDoesNotExist : public Exception
{
explicit Exception_DirDoesNotExist(QString dir) noexcept
: Exception("Directory does not exist: " + dir) {}
};
struct Exception_FileDoesNotExist : public Exception
{
explicit Exception_FileDoesNotExist(QString filename) noexcept
: Exception("File does not exist: " + filename) {}
};
struct Exception_UnableToLoadFile : public Exception
{
explicit Exception_UnableToLoadFile(QString filename) noexcept
: Exception("Unable to load file: " + filename) {}
};
struct Exception_UnableToOpenDatabase : public Exception
{
explicit Exception_UnableToOpenDatabase(QString dbname) noexcept
: Exception("Unable to open database: " + dbname) {}
};
struct Exception_MissingJsonValue : public Exception
{
explicit Exception_MissingJsonValue(QString source) noexcept
: Exception("Missing JSON value: " + source) {}
};
#endif // EXCEPTIONS_H