Provide more information in connect errors
This commit is contained in:
parent
d2d157c1fe
commit
eae9d45c8a
@ -88,11 +88,24 @@ public class Util
|
|||||||
* @return a string representing information about the {@link Throwable}
|
* @return a string representing information about the {@link Throwable}
|
||||||
*/
|
*/
|
||||||
public static String exception(Throwable t)
|
public static String exception(Throwable t)
|
||||||
|
{
|
||||||
|
return exception( t, true );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs a pretty one line version of a {@link Throwable}. Useful for
|
||||||
|
* debugging.
|
||||||
|
*
|
||||||
|
* @param t the {@link Throwable} to format.
|
||||||
|
* @param includeLineNumbers whether to include line numbers
|
||||||
|
* @return a string representing information about the {@link Throwable}
|
||||||
|
*/
|
||||||
|
public static String exception(Throwable t, boolean includeLineNumbers)
|
||||||
{
|
{
|
||||||
// TODO: We should use clear manually written exceptions
|
// TODO: We should use clear manually written exceptions
|
||||||
StackTraceElement[] trace = t.getStackTrace();
|
StackTraceElement[] trace = t.getStackTrace();
|
||||||
return t.getClass().getSimpleName() + " : " + t.getMessage()
|
return t.getClass().getSimpleName() + " : " + t.getMessage()
|
||||||
+ ( ( trace.length > 0 ) ? " @ " + t.getStackTrace()[0].getClassName() + ":" + t.getStackTrace()[0].getLineNumber() : "" );
|
+ ( ( includeLineNumbers && trace.length > 0 ) ? " @ " + t.getStackTrace()[0].getClassName() + ":" + t.getStackTrace()[0].getLineNumber() : "" );
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String csv(Iterable<?> objects)
|
public static String csv(Iterable<?> objects)
|
||||||
|
@ -8,7 +8,6 @@ import io.netty.channel.ChannelFuture;
|
|||||||
import io.netty.channel.ChannelFutureListener;
|
import io.netty.channel.ChannelFutureListener;
|
||||||
import io.netty.channel.ChannelInitializer;
|
import io.netty.channel.ChannelInitializer;
|
||||||
import io.netty.channel.ChannelOption;
|
import io.netty.channel.ChannelOption;
|
||||||
import io.netty.channel.ConnectTimeoutException;
|
|
||||||
import io.netty.util.internal.PlatformDependent;
|
import io.netty.util.internal.PlatformDependent;
|
||||||
import java.net.InetSocketAddress;
|
import java.net.InetSocketAddress;
|
||||||
import java.net.SocketAddress;
|
import java.net.SocketAddress;
|
||||||
@ -373,13 +372,7 @@ public final class UserConnection implements ProxiedPlayer
|
|||||||
|
|
||||||
private String connectionFailMessage(Throwable cause)
|
private String connectionFailMessage(Throwable cause)
|
||||||
{
|
{
|
||||||
if ( cause instanceof ConnectTimeoutException )
|
return Util.exception( cause, false );
|
||||||
{
|
|
||||||
return bungee.getTranslation( "timeout" );
|
|
||||||
} else
|
|
||||||
{
|
|
||||||
return cause.getClass().getName();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -5,9 +5,8 @@ already_connecting=\u00a7cAlready connecting to this server!
|
|||||||
command_list=\u00a7a[{0}] \u00a7e({1}): \u00a7r{2}
|
command_list=\u00a7a[{0}] \u00a7e({1}): \u00a7r{2}
|
||||||
connect_kick=\u00a7cKicked whilst connecting to {0}: {1}
|
connect_kick=\u00a7cKicked whilst connecting to {0}: {1}
|
||||||
current_server=\u00a76You are currently connected to {0}.
|
current_server=\u00a76You are currently connected to {0}.
|
||||||
fallback_kick=\u00a7cCould not connect to a default or fallback server, please try again later: {0}
|
fallback_kick=\u00a7cCould not connect to a default or fallback server. Incorrectly configured address/port/firewall? {0}
|
||||||
fallback_lobby=\u00a7cCould not connect to target server, you have been moved to a fallback server.
|
fallback_lobby=\u00a7cCould not connect to target server, you have been moved to a fallback server.
|
||||||
timeout=Server not reachable (timeout). Offline? Incorrectly configured address/port/firewall?
|
|
||||||
lost_connection=[Proxy] Lost connection to server.
|
lost_connection=[Proxy] Lost connection to server.
|
||||||
mojang_fail=Error occurred while contacting login servers, are they down?
|
mojang_fail=Error occurred while contacting login servers, are they down?
|
||||||
no_permission=\u00a7cYou do not have permission to execute this command!
|
no_permission=\u00a7cYou do not have permission to execute this command!
|
||||||
|
Loading…
Reference in New Issue
Block a user