Change crash reporter plugin to send callstack array
Summary: Change crash reporter plugin to send callstackas an array instead of string Reviewed By: jknoxville Differential Revision: D13254853 fbshipit-source-id: 0baefb3eb6d3afc38d0c6acc7840ddc981230f9d
This commit is contained in:
committed by
Facebook Github Bot
parent
b635b7e4aa
commit
d37fa7ba95
@@ -9,11 +9,10 @@ package com.facebook.flipper.plugins.crashreporter;
|
|||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.support.annotation.Nullable;
|
import android.support.annotation.Nullable;
|
||||||
|
import com.facebook.flipper.core.FlipperArray;
|
||||||
import com.facebook.flipper.core.FlipperConnection;
|
import com.facebook.flipper.core.FlipperConnection;
|
||||||
import com.facebook.flipper.core.FlipperObject;
|
import com.facebook.flipper.core.FlipperObject;
|
||||||
import com.facebook.flipper.core.FlipperPlugin;
|
import com.facebook.flipper.core.FlipperPlugin;
|
||||||
import java.io.PrintWriter;
|
|
||||||
import java.io.StringWriter;
|
|
||||||
|
|
||||||
public class CrashReporterPlugin implements FlipperPlugin {
|
public class CrashReporterPlugin implements FlipperPlugin {
|
||||||
public static final String ID = "CrashReporter";
|
public static final String ID = "CrashReporter";
|
||||||
@@ -41,15 +40,17 @@ public class CrashReporterPlugin implements FlipperPlugin {
|
|||||||
public void uncaughtException(Thread paramThread, Throwable paramThrowable) {
|
public void uncaughtException(Thread paramThread, Throwable paramThrowable) {
|
||||||
if (mConnection != null) {
|
if (mConnection != null) {
|
||||||
FlipperConnection connection = mConnection;
|
FlipperConnection connection = mConnection;
|
||||||
StringWriter sw = new StringWriter();
|
FlipperArray.Builder builder = new FlipperArray.Builder();
|
||||||
PrintWriter pw = new PrintWriter(sw);
|
for (StackTraceElement stackTraceElement : paramThrowable.getStackTrace()) {
|
||||||
paramThrowable.printStackTrace(pw);
|
builder.put(stackTraceElement.toString());
|
||||||
|
}
|
||||||
|
FlipperArray arr = builder.build();
|
||||||
connection.send(
|
connection.send(
|
||||||
"crash-report",
|
"crash-report",
|
||||||
new FlipperObject.Builder()
|
new FlipperObject.Builder()
|
||||||
.put("callstack", sw.toString())
|
.put("callstack", arr)
|
||||||
.put("cause", paramThrowable.toString())
|
.put("name", paramThrowable.toString())
|
||||||
.put("reason", paramThrowable.toString())
|
.put("reason", paramThrowable.getMessage())
|
||||||
.build());
|
.build());
|
||||||
}
|
}
|
||||||
if (prevHandler != null) {
|
if (prevHandler != null) {
|
||||||
|
|||||||
Reference in New Issue
Block a user