Display error codes when the connection is terminated

This commit is contained in:
Cameron Gutman 2023-12-30 21:14:22 -06:00
parent a102ec4ee8
commit 69387c32ad
2 changed files with 12 additions and 2 deletions

View File

@ -2371,7 +2371,16 @@ public class Game extends Activity implements SurfaceHolder.Callback,
break; break;
default: default:
message = getResources().getString(R.string.conn_terminated_msg); String errorCodeString;
// We'll assume large errors are hex values
if (Math.abs(errorCode) > 1000) {
errorCodeString = Integer.toHexString(errorCode);
}
else {
errorCodeString = Integer.toString(errorCode);
}
message = getResources().getString(R.string.conn_terminated_msg) + "\n\n" +
getResources().getString(R.string.error_code_prefix) + " " + errorCodeString;
break; break;
} }
} }

View File

@ -90,7 +90,8 @@
<string name="conn_error_title">Connection Error</string> <string name="conn_error_title">Connection Error</string>
<string name="conn_error_msg">Failed to start</string> <string name="conn_error_msg">Failed to start</string>
<string name="conn_terminated_title">Connection Terminated</string> <string name="conn_terminated_title">Connection Terminated</string>
<string name="conn_terminated_msg">The connection was terminated</string> <string name="conn_terminated_msg">The connection was terminated.</string>
<string name="error_code_prefix">Error code:</string>
<!-- General strings --> <!-- General strings -->
<string name="ip_hint">IP address of host PC</string> <string name="ip_hint">IP address of host PC</string>