The Battle for Wesnoth  1.17.0-dev
exception.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2011 - 2021
3  by Mark de Wever <koraq@xs4all.nl>
4  Part of the Battle for Wesnoth Project https://www.wesnoth.org/
5 
6  This program is free software; you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation; either version 2 of the License, or
9  (at your option) any later version.
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY.
12 
13  See the COPYING file for more details.
14 */
15 
16 /**
17  * @file
18  * Contains the exceptions thrown by the @ref gui2::iteration::iterator classes.
19  */
20 
21 #pragma once
22 
24 
25 #include <stdexcept>
26 #include <string>
27 
28 namespace gui2
29 {
30 
31 namespace iteration
32 {
33 
34 /**
35  * Thrown when deferring an invalid iterator.
36  *
37  * Invalid means the initial state at_end() == true.
38  */
39 class logic_error : public std::logic_error, public lua_jailbreak_exception
40 {
41 public:
42  explicit logic_error(const std::string& message)
43  : std::logic_error("GUI2 ITERATOR: " + message)
45  {
46  }
47 
48 private:
50 };
51 
52 /**
53  * Thrown when moving an invalid iterator.
54  *
55  * Invalid means the initial state at_end() == true.
56  */
57 class range_error : public std::range_error, public lua_jailbreak_exception
58 {
59 public:
60  explicit range_error(const std::string& message)
61  : std::range_error("GUI2 ITERATOR: " + message)
63  {
64  }
65 
66 private:
68 };
69 
70 } // namespace iteration
71 
72 } // namespace gui2
#define IMPLEMENT_LUA_JAILBREAK_EXCEPTION(type)
Helper macro for classes deriving from lua_jailbreak_exception.
Main class to show messages to the user.
Definition: message.hpp:35
STL namespace.
range_error(const std::string &message)
Definition: exception.hpp:60
Generic file dialog.
Definition: field-fwd.hpp:23
Thrown when moving an invalid iterator.
Definition: exception.hpp:57
Thrown when deferring an invalid iterator.
Definition: exception.hpp:39
Base class for exceptions that want to be thrown &#39;through&#39; lua.
logic_error(const std::string &message)
Definition: exception.hpp:42