Mholloway has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/371730 )
Change subject: Update RemoteLogException ...................................................................... Update RemoteLogException * Marshal and log the whole throwable, if one is given, to maximize info gathered * Simplify the class's interface * Specify that parameters should be @NonNull Change-Id: I26ae1cc24196cb2a6eda490f2d01e6d7d89241d9 --- M app/src/main/java/org/wikipedia/crash/RemoteLogException.java 1 file changed, 7 insertions(+), 16 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/apps/android/wikipedia refs/changes/30/371730/1 diff --git a/app/src/main/java/org/wikipedia/crash/RemoteLogException.java b/app/src/main/java/org/wikipedia/crash/RemoteLogException.java index 828999b..405f75f 100644 --- a/app/src/main/java/org/wikipedia/crash/RemoteLogException.java +++ b/app/src/main/java/org/wikipedia/crash/RemoteLogException.java @@ -1,9 +1,10 @@ package org.wikipedia.crash; import android.support.annotation.NonNull; -import android.support.annotation.Nullable; import org.json.JSONObject; +import org.wikipedia.json.GsonMarshaller; +import org.wikipedia.json.GsonUtil; import java.util.HashMap; import java.util.Map; @@ -12,17 +13,14 @@ public class RemoteLogException extends Exception { @NonNull private final Map<String, String> props = new HashMap<>(); - public RemoteLogException(@Nullable String message) { - this(message, null); + public RemoteLogException(@NonNull String message) { + super(message); + props.put("message", message); } - public RemoteLogException(@Nullable Throwable throwable) { - this(null, throwable); - } - - public RemoteLogException(@Nullable String message, @Nullable Throwable throwable) { + public RemoteLogException(@NonNull Throwable throwable) { super(throwable); - putMessage(message == null && throwable != null ? throwable.getMessage() : message); + props.put("throwable", GsonMarshaller.marshal(GsonUtil.getDefaultGson(), throwable)); } public RemoteLogException put(String key, String value) { @@ -32,14 +30,7 @@ @Override public String getMessage() { - super.getMessage(); return propsToJsonMsg(); - } - - private void putMessage(@Nullable String message) { - if (message != null) { - props.put("message", message); - } } private String propsToJsonMsg() { -- To view, visit https://gerrit.wikimedia.org/r/371730 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I26ae1cc24196cb2a6eda490f2d01e6d7d89241d9 Gerrit-PatchSet: 1 Gerrit-Project: apps/android/wikipedia Gerrit-Branch: master Gerrit-Owner: Mholloway <mhollo...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits