The Battle for Wesnoth 1.21.0-dev
 
Loading...
Searching...
No Matches
wesnothd_connection_error.hpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2011 - 2025
3 by Sergey Popov <loonycyborg@gmail.com>
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#pragma once
17
18#include "exceptions.hpp"
20
21#include <boost/system/error_code.hpp>
22
23/** An error occurred during when trying to communicate with the wesnothd server. */
25{
26 wesnothd_error(const std::string& error)
27 : game::error(error)
28 {
29 }
30};
31
32/**
33 * Error used when the client is rejected by the MP server.
34 * Technically, this is not an error but the only way to handle the condition is as if it were an error.
35 */
37{
38 wesnothd_rejected_client_error(const std::string& msg)
39 : game::error(msg)
40 {
41 }
42};
43
44/**
45 * We received invalid data from wesnothd during a game
46 * This means we cannot continue with the game but we can stay connected to wesnothd and start a new game.
47 * TODO: find a short name
48 */
59
70
71/**
72 * An error occurred inside the underlying network communication code (boost asio)
73 * TODO: find a short name
74 */
76{
77 wesnothd_connection_error(const boost::system::error_code& error, const std::string& msg = "")
79 , user_message(msg)
80 {
81 this->store();
82 }
83
84 /** User-friendly and potentially translated message for use in the UI. */
85 std::string user_message;
86
88};
Base class for exceptions that want to be thrown 'through' lua.
void store() const noexcept
Stores a copy the current exception to be rethrown.
#define IMPLEMENT_LUA_JAILBREAK_EXCEPTION(type)
Helper macro for classes deriving from lua_jailbreak_exception.
Base class for all the errors encountered by the engine.
std::string message
We received invalid data from wesnothd during a game This means we cannot continue with the game but ...
ingame_wesnothd_error(const std::string &error)
leavegame_wesnothd_error(const std::string &error)
An error occurred inside the underlying network communication code (boost asio) TODO: find a short na...
wesnothd_connection_error(const boost::system::error_code &error, const std::string &msg="")
std::string user_message
User-friendly and potentially translated message for use in the UI.
An error occurred during when trying to communicate with the wesnothd server.
wesnothd_error(const std::string &error)
Error used when the client is rejected by the MP server.
wesnothd_rejected_client_error(const std::string &msg)