/* Copyright (C) 2010 - 2023 by Guillaume Melquiond Part of the Battle for Wesnoth Project https://www.wesnoth.org/ 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 2 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. See the COPYING file for more details. */ #pragma once #include #include namespace game { /** * Base class for all the errors encountered by the engine. * It provides a field for storing custom messages related to the actual * error. */ struct error : std::exception { std::string message; error() : message() {} error(const std::string &msg) : message(msg) {} ~error() noexcept {} const char *what() const noexcept { return message.c_str(); } }; }