未验证 提交 0345967a 编写于 作者: A Amir Hardon 提交者: GitHub

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

上级 bb8e6e4d
......@@ -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
);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册