You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@weex.apache.org by ac...@apache.org on 2017/08/22 08:29:10 UTC
[1/2] incubator-weex git commit: * [ios] expose js runtime exception
@notdanger
Repository: incubator-weex
Updated Branches:
refs/heads/0.16-dev c171b4f97 -> e10aadc15
* [ios] expose js runtime exception @notdanger
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/f45bd2f5
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/f45bd2f5
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/f45bd2f5
Branch: refs/heads/0.16-dev
Commit: f45bd2f58bca6e47fe172af4aa2f353ef47f9dac
Parents: 6b782f6
Author: acton393 <zh...@gmail.com>
Authored: Tue Aug 22 11:54:25 2017 +0800
Committer: acton393 <zh...@gmail.com>
Committed: Tue Aug 22 11:54:25 2017 +0800
----------------------------------------------------------------------
ios/sdk/WeexSDK/Sources/Bridge/WXJSCoreBridge.m | 5 ++++-
ios/sdk/WeexSDK/Sources/Model/WXSDKInstance.h | 7 +++++++
2 files changed, 11 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/f45bd2f5/ios/sdk/WeexSDK/Sources/Bridge/WXJSCoreBridge.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Bridge/WXJSCoreBridge.m b/ios/sdk/WeexSDK/Sources/Bridge/WXJSCoreBridge.m
index 10c6cf4..dd776a9 100644
--- a/ios/sdk/WeexSDK/Sources/Bridge/WXJSCoreBridge.m
+++ b/ios/sdk/WeexSDK/Sources/Bridge/WXJSCoreBridge.m
@@ -151,11 +151,14 @@
id<WXJSExceptionProtocol> jsExceptionHandler = [WXHandlerFactory handlerForProtocol:@protocol(WXJSExceptionProtocol)];
WXSDKInstance *instance = [WXSDKEngine topInstance];
+ WXJSExceptionInfo * jsExceptionInfo = [[WXJSExceptionInfo alloc] initWithInstanceId:instance.instanceId bundleUrl:[instance.scriptURL absoluteString] errorCode:[NSString stringWithFormat:@"%d", WX_ERR_JS_EXECUTE] functionName:@"" exception:[NSString stringWithFormat:@"[%@:%@] %@\n%@",exception[@"line"], exception[@"column"],[exception toString], exception[@"stack"]] userInfo:nil];
if ([jsExceptionHandler respondsToSelector:@selector(onJSException:)]) {
- WXJSExceptionInfo * jsExceptionInfo = [[WXJSExceptionInfo alloc] initWithInstanceId:instance.instanceId bundleUrl:[instance.scriptURL absoluteString] errorCode:[NSString stringWithFormat:@"%d", WX_ERR_JS_EXECUTE] functionName:@"" exception:[NSString stringWithFormat:@"[%@:%@] %@\n%@",exception[@"line"], exception[@"column"],[exception toString], exception[@"stack"]] userInfo:nil];
[jsExceptionHandler onJSException:jsExceptionInfo];
}
WX_MONITOR_FAIL(WXMTJSBridge, WX_ERR_JS_EXECUTE, message);
+ if (instance.onJSRuntimeException) {
+ instance.onJSRuntimeException(jsExceptionInfo);
+ }
};
if (WX_SYS_VERSION_LESS_THAN(@"8.0")) {
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/f45bd2f5/ios/sdk/WeexSDK/Sources/Model/WXSDKInstance.h
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Model/WXSDKInstance.h b/ios/sdk/WeexSDK/Sources/Model/WXSDKInstance.h
index b846afa..74171e6 100644
--- a/ios/sdk/WeexSDK/Sources/Model/WXSDKInstance.h
+++ b/ios/sdk/WeexSDK/Sources/Model/WXSDKInstance.h
@@ -140,6 +140,13 @@ typedef NS_ENUM(NSInteger, WXErrorCode) {//error.code
@property (nonatomic, copy) void (^onFailed)(NSError *error);
/**
+ * The callback triggered when js occurs runtime error while executing.
+ *
+ * @return A block that takes a WXJSExceptionInfo argument, which is the exception info
+ **/
+@property (nonatomic, copy) void (^onJSRuntimeException)(WXJSExceptionInfo * jsException);
+
+/**
* The callback triggered when the instacne executes scrolling .
*
* @return A block that takes a CGPoint argument, which is content offset of the scroller
[2/2] incubator-weex git commit: Merge branch
'0.16-dev-jsruntimeException' of https://github.com/acton393/incubator-weex
into wip-us-0.16-dev
Posted by ac...@apache.org.
Merge branch '0.16-dev-jsruntimeException' of https://github.com/acton393/incubator-weex into wip-us-0.16-dev
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/e10aadc1
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/e10aadc1
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/e10aadc1
Branch: refs/heads/0.16-dev
Commit: e10aadc1553223d9a8dc84f820366e837c8c9c48
Parents: c171b4f f45bd2f
Author: acton393 <zh...@gmail.com>
Authored: Tue Aug 22 16:29:42 2017 +0800
Committer: acton393 <zh...@gmail.com>
Committed: Tue Aug 22 16:29:42 2017 +0800
----------------------------------------------------------------------
ios/sdk/WeexSDK/Sources/Bridge/WXJSCoreBridge.m | 5 ++++-
ios/sdk/WeexSDK/Sources/Model/WXSDKInstance.h | 7 +++++++
2 files changed, 11 insertions(+), 1 deletion(-)
----------------------------------------------------------------------