Include Java stack trace in method channel invocations (flutter/engine#11361)

This commit is contained in:
Amir Hardon
2019-08-22 09:02:31 -07:00
committed by GitHub
parent ae2bad02f6
commit 33e25fa607

View File

@@ -7,6 +7,8 @@ package io.flutter.embedding.engine.systemchannels;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.nio.ByteBuffer;
import java.util.List;
import java.util.Map;
@@ -36,6 +38,13 @@ public class PlatformViewsChannel {
channel.invokeMethod("viewFocused", viewId);
}
private static String detailedExceptionString(Exception exception) {
StringWriter stringWriter = new StringWriter();
PrintWriter printWriter = new PrintWriter(stringWriter);
exception.printStackTrace(printWriter);
return stringWriter.toString();
}
private final MethodChannel.MethodCallHandler parsingHandler = new MethodChannel.MethodCallHandler() {
@Override
public void onMethodCall(@NonNull MethodCall call, @NonNull MethodChannel.Result result) {
@@ -89,7 +98,7 @@ public class PlatformViewsChannel {
} catch (IllegalStateException exception) {
result.error(
"error",
exception.getMessage(),
detailedExceptionString(exception),
null
);
}
@@ -103,7 +112,7 @@ public class PlatformViewsChannel {
} catch (IllegalStateException exception) {
result.error(
"error",
exception.getMessage(),
detailedExceptionString(exception),
null
);
}
@@ -129,7 +138,7 @@ public class PlatformViewsChannel {
} catch (IllegalStateException exception) {
result.error(
"error",
exception.getMessage(),
detailedExceptionString(exception),
null
);
}
@@ -161,7 +170,7 @@ public class PlatformViewsChannel {
} catch (IllegalStateException exception) {
result.error(
"error",
exception.getMessage(),
detailedExceptionString(exception),
null
);
}
@@ -181,7 +190,7 @@ public class PlatformViewsChannel {
} catch (IllegalStateException exception) {
result.error(
"error",
exception.getMessage(),
detailedExceptionString(exception),
null
);
}
@@ -195,7 +204,7 @@ public class PlatformViewsChannel {
} catch (IllegalStateException exception) {
result.error(
"error",
exception.getMessage(),
detailedExceptionString(exception),
null
);
}