00001 /* $Id: exceptions.hpp 52533 2012-01-07 02:35:17Z shadowmaster $ */ 00002 /* 00003 Copyright (C) 2010 - 2012 by Guillaume Melquiond <guillaume.melquiond@gmail.com> 00004 Part of the Battle for Wesnoth Project http://www.wesnoth.org/ 00005 00006 This program is free software; you can redistribute it and/or modify 00007 it under the terms of the GNU General Public License as published by 00008 the Free Software Foundation; either version 2 of the License, or 00009 (at your option) any later version. 00010 This program is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY. 00012 00013 See the COPYING file for more details. 00014 */ 00015 #ifndef EXCEPTIONS_HPP_INCLUDED 00016 #define EXCEPTIONS_HPP_INCLUDED 00017 00018 #include <exception> 00019 #include <string> 00020 00021 namespace game { 00022 00023 /** 00024 * Base class for all the errors encountered by the engine. 00025 * It provides a field for storing custom messages related to the actual 00026 * error. 00027 */ 00028 struct error : std::exception 00029 { 00030 std::string message; 00031 00032 error() : message() {} 00033 error(const std::string &msg) : message(msg) {} 00034 ~error() throw() {} 00035 00036 const char *what() const throw() 00037 { 00038 return message.c_str(); 00039 } 00040 }; 00041 00042 } 00043 00044 #endif
| Generated by doxygen 1.7.1 on Thu May 24 2012 01:02:36 for The Battle for Wesnoth | Gna! | Forum | Wiki | CIA | devdocs |