Luanti 5.11.0-dev
 
Loading...
Searching...
No Matches
exceptions.h
Go to the documentation of this file.
1// Luanti
2// SPDX-License-Identifier: LGPL-2.1-or-later
3// Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>
4
5#pragma once
6
7#include <exception>
8#include <string>
9
10
11class BaseException : public std::exception
12{
13public:
14 BaseException(const std::string &s) noexcept: m_s(s) {}
15 ~BaseException() throw() = default;
16
17 virtual const char * what() const noexcept
18 {
19 return m_s.c_str();
20 }
21protected:
22 std::string m_s;
23};
24
26public:
27 AlreadyExistsException(const std::string &s): BaseException(s) {}
28};
29
31public:
32 VersionMismatchException(const std::string &s): BaseException(s) {}
33};
34
36public:
37 FileNotGoodException(const std::string &s): BaseException(s) {}
38};
39
41public:
42 DatabaseException(const std::string &s): BaseException(s) {}
43};
44
46public:
47 SerializationError(const std::string &s): BaseException(s) {}
48};
49
50class PacketError : public BaseException {
51public:
52 PacketError(const std::string &s): BaseException(s) {}
53};
54
56public:
57 SettingNotFoundException(const std::string &s): BaseException(s) {}
58};
59
61public:
62 ItemNotFoundException(const std::string &s): BaseException(s) {}
63};
64
65class ServerError : public BaseException {
66public:
67 ServerError(const std::string &s): BaseException(s) {}
68};
69
71public:
72 ClientStateError(const std::string &s): BaseException(s) {}
73};
74
76public:
77 PrngException(const std::string &s): BaseException(s) {}
78};
79
81public:
82 ShaderException(const std::string &s): BaseException(s) {}
83};
84
85class ModError : public BaseException {
86public:
87 ModError(const std::string &s): BaseException(s) {}
88};
89
90
91/*
92 Some "old-style" interrupts:
93*/
94
96public:
98 BaseException("One or more noise parameters were invalid or require "
99 "too much memory")
100 {}
101
102 InvalidNoiseParamsException(const std::string &s):
104 {}
105};
106
108{
109public:
111 BaseException("Somebody tried to get/set something in a nonexistent position.")
112 {}
113 InvalidPositionException(const std::string &s):
115 {}
116};
Definition exceptions.h:25
AlreadyExistsException(const std::string &s)
Definition exceptions.h:27
Definition exceptions.h:12
virtual const char * what() const noexcept
Definition exceptions.h:17
BaseException(const std::string &s) noexcept
Definition exceptions.h:14
std::string m_s
Definition exceptions.h:22
~BaseException()=default
Definition exceptions.h:70
ClientStateError(const std::string &s)
Definition exceptions.h:72
Definition exceptions.h:40
DatabaseException(const std::string &s)
Definition exceptions.h:42
Definition exceptions.h:35
FileNotGoodException(const std::string &s)
Definition exceptions.h:37
Definition exceptions.h:95
InvalidNoiseParamsException(const std::string &s)
Definition exceptions.h:102
InvalidNoiseParamsException()
Definition exceptions.h:97
Definition exceptions.h:108
InvalidPositionException()
Definition exceptions.h:110
InvalidPositionException(const std::string &s)
Definition exceptions.h:113
Definition exceptions.h:60
ItemNotFoundException(const std::string &s)
Definition exceptions.h:62
Definition exceptions.h:85
ModError(const std::string &s)
Definition exceptions.h:87
Definition exceptions.h:50
PacketError(const std::string &s)
Definition exceptions.h:52
Definition exceptions.h:75
PrngException(const std::string &s)
Definition exceptions.h:77
Definition exceptions.h:45
SerializationError(const std::string &s)
Definition exceptions.h:47
Definition exceptions.h:65
ServerError(const std::string &s)
Definition exceptions.h:67
Definition exceptions.h:55
SettingNotFoundException(const std::string &s)
Definition exceptions.h:57
Definition exceptions.h:80
ShaderException(const std::string &s)
Definition exceptions.h:82
Definition exceptions.h:30
VersionMismatchException(const std::string &s)
Definition exceptions.h:32