shadowm icon

Untitled

shadowm | PRO | 05/04/18 05:43:21 AM UTC | 0 ⭐ | 393 👁️ | Never ⏰ | []
C++ |

1.09 KB

|

None

|

0 👍

/

0 👎

    } catch(wesnothd_error& e) {
        if(!e.message.empty()) {
            ERR_NET << "caught network error: " << e.message << std::endl;
 
            std::string user_msg;
 
            if(dynamic_cast<wesnothd_connection_error*>(&e)) {
                // The wesnothd_connection_error subclass is only thrown with messages
                // from boost::system::error_code which we can't translate ourselves.
                // It's also the originator of the infamous EOF error that happens when
                // the server dies. <https://github.com/wesnoth/wesnoth/issues/3005>
                if(e.message == "End of file") {
                    user_msg = _("Disconnected from server.");
                } else if(e.message == "Connection refused") {
                    user_msg = _("Server is offline.");
                } else {
                    user_msg = _("Connection error: ") + translation::gettext(e.message.c_str());
                }
            } else {
                // This will be a message from the server itself, which we can
                // probably translate.
                user_msg = translation::gettext(e.message.c_str());
            }
 
            gui2::show_transient_error_message(user_msg);
        } else {
            ERR_NET << "caught network error" << std::endl;
        }
    } catch(config::error& e) {

Comments