mirror of
https://github.com/wesnoth/wesnoth
synced 2025-04-27 08:24:11 +00:00
43 lines
980 B
C++
43 lines
980 B
C++
/*
|
|
Copyright (C) 2010 - 2023
|
|
by Guillaume Melquiond <guillaume.melquiond@gmail.com>
|
|
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 <exception>
|
|
#include <string>
|
|
|
|
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();
|
|
}
|
|
};
|
|
|
|
}
|