The Battle for Wesnoth  1.13.4+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
exceptions.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2010 - 2016 by Guillaume Melquiond <[email protected]>
3  Part of the Battle for Wesnoth Project http://www.wesnoth.org/
4 
5  This program is free software; you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation; either version 2 of the License, or
8  (at your option) any later version.
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY.
11 
12  See the COPYING file for more details.
13 */
14 #ifndef EXCEPTIONS_HPP_INCLUDED
15 #define EXCEPTIONS_HPP_INCLUDED
16 
17 #include <exception>
18 #include <string>
19 
20 namespace game {
21 
22 /**
23  * Base class for all the errors encountered by the engine.
24  * It provides a field for storing custom messages related to the actual
25  * error.
26  */
27 struct error : std::exception
28 {
30 
31  error() : message() {}
32  error(const std::string &msg) : message(msg) {}
33  ~error() throw() {}
34 
35  const char *what() const throw()
36  {
37  return message.c_str();
38  }
39 };
40 
41 }
42 
43 #endif
const char * what() const
Definition: exceptions.hpp:35
static void msg(const char *act, debug_info &i, const char *to="", const char *result="")
Definition: debugger.cpp:112
Base class for all the errors encountered by the engine.
Definition: exceptions.hpp:27
std::string message
Definition: exceptions.hpp:29
error(const std::string &msg)
Definition: exceptions.hpp:32
GLsizei const GLcharARB ** string
Definition: glew.h:4503