The Battle for Wesnoth  1.15.1+dev
wesnothd_connection_error.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2011 - 2018 by Sergey Popov <loonycyborg@gmail.com>
3  Part of the Battle for Wesnoth Project https://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 
15 #pragma once
16 
17 #include <boost/system/error_code.hpp>
18 #include "exceptions.hpp"
20 ///An error occurred during when trying to coommunicate with the wesnothd server.
21 struct wesnothd_error : public game::error
22 {
23  wesnothd_error(const std::string& error) : game::error(error) {}
24 };
25 
26 /**
27  * Error used when the client is rejected by the MP server.
28  * Technically, this is not an error but the only way to handle the condition is as if it were an error.
29  */
31 {
32  wesnothd_rejected_client_error (const std::string& msg) : game::error (msg) {}
33 };
34 
35 ///We received invalid data from wesnothd during a game
36 ///This means we cannot continue with the game but we can stay connected to wesnothd and start a new game
37 ///TODO: find a short name
39 {
40  ingame_wesnothd_error(const std::string& error) : wesnothd_error(error) {}
42 };
43 
45 {
46  leavegame_wesnothd_error(const std::string& error) : ingame_wesnothd_error(error) {}
47 };
48 
49 ///an error occurred inside the underlying network communication code (boost asio)
50 ///TODO: find a short name
52 {
53  wesnothd_connection_error(const boost::system::error_code& error, const std::string& msg = "")
54  : wesnothd_error(error.message())
55  , user_message(msg)
56  {}
57 
58  /** User-friendly and potentially translated message for use in the UI. */
59  std::string user_message;
60 
62 };
an error occurred inside the underlying network communication code (boost asio) TODO: find a short na...
An error occurred during when trying to coommunicate with the wesnothd server.
leavegame_wesnothd_error(const std::string &error)
Error used when the client is rejected by the MP server.
#define IMPLEMENT_LUA_JAILBREAK_EXCEPTION(type)
Helper macro for classes deriving from lua_jailbreak_exception.
wesnothd_rejected_client_error(const std::string &msg)
static void msg(const char *act, debug_info &i, const char *to="", const char *result="")
Definition: debugger.cpp:109
wesnothd_error(const std::string &error)
std::string user_message
User-friendly and potentially translated message for use in the UI.
ingame_wesnothd_error(const std::string &error)
We received invalid data from wesnothd during a game This means we cannot continue with the game but ...
wesnothd_connection_error(const boost::system::error_code &error, const std::string &msg="")
Base class for all the errors encountered by the engine.
Definition: exceptions.hpp:29
std::string message
Definition: exceptions.hpp:31
Base class for exceptions that want to be thrown &#39;through&#39; lua.