global: Clean up error logging

Signed-off-by: Samuel Holland <samuel@sholland.org>
This commit is contained in:
Samuel Holland
2018-01-09 09:37:49 -06:00
parent a1d955ef62
commit daacc06a0d
5 changed files with 13 additions and 10 deletions
@@ -41,7 +41,7 @@ public final class TunnelController {
else
tunnel = null;
if (tunnel == null) {
Log.e(TAG, "setChecked() from a null tunnel", new IllegalStateException());
Log.e(TAG, "setChecked() from a null tunnel", new IllegalStateException("No tunnel"));
return;
}
tunnel.setState(State.of(checked)).whenComplete((state, throwable) -> {
@@ -51,15 +51,16 @@ public final class TunnelController {
if (throwable instanceof ErrnoException
&& ((ErrnoException) throwable).errno == OsConstants.ENODEV) {
final String message = context.getString(R.string.not_supported_message);
final String title = context.getString(R.string.not_supported_title);
final AlertDialog dialog = new AlertDialog.Builder(context)
.setMessage(Html.fromHtml(message))
.setPositiveButton(R.string.ok, null)
.setTitle(R.string.not_supported_title)
.setTitle(title)
.show();
// Make links work.
((TextView) dialog.findViewById(android.R.id.message))
.setMovementMethod(LinkMovementMethod.getInstance());
Log.e(TAG, "WireGuard not supported");
Log.e(TAG, title, throwable);
} else {
final String error = ExceptionLoggers.unwrap(throwable).getMessage();
final int messageResId = checked ? R.string.error_up : R.string.error_down;