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/17 02:18:09 UTC
[3/7] incubator-weex git commit: * [ios] update assert pageName
* [ios] update assert pageName
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/72f9dc47
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/72f9dc47
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/72f9dc47
Branch: refs/heads/0.16-dev
Commit: 72f9dc47249cd9038838bb0cba4413ca6eafb257
Parents: b7d1b04
Author: acton393 <zh...@gmail.com>
Authored: Tue Aug 15 19:21:31 2017 +0800
Committer: acton393 <zh...@gmail.com>
Committed: Tue Aug 15 19:21:31 2017 +0800
----------------------------------------------------------------------
ios/sdk/WeexSDK/Sources/Model/WXSDKInstance.m | 8 +++++++-
ios/sdk/WeexSDK/Sources/Protocol/WXJSExceptionProtocol.h | 10 ++++++++++
ios/sdk/WeexSDK/Sources/Utility/WXAssert.h | 3 ---
3 files changed, 17 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/72f9dc47/ios/sdk/WeexSDK/Sources/Model/WXSDKInstance.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Model/WXSDKInstance.m b/ios/sdk/WeexSDK/Sources/Model/WXSDKInstance.m
index 6c75dc8..2c75adf 100644
--- a/ios/sdk/WeexSDK/Sources/Model/WXSDKInstance.m
+++ b/ios/sdk/WeexSDK/Sources/Model/WXSDKInstance.m
@@ -43,6 +43,7 @@
#import "WXConvert.h"
#import "WXPrerenderManager.h"
#import "WXTracingManager.h"
+#import "WXJSExceptionProtocol.h"
NSString *const bundleUrlOptionKey = @"bundleUrl";
@@ -175,7 +176,12 @@ typedef enum : NSUInteger {
WXLog(@"Start rendering page:%@", self.pageName);
} else {
WXLogWarning(@"WXSDKInstance's pageName should be specified.");
- WXAssertCondition(![WXUtility isBlankString:_pageName], WXSDKInstance.pageName);
+ id<WXJSExceptionProtocol> jsExceptionHandler = [WXHandlerFactory handlerForProtocol:@protocol(WXJSExceptionProtocol)];
+ if ([jsExceptionHandler respondsToSelector:@selector(onJSException:)]) {
+ WXRuntimeCheckException * runtimeCheckException = [WXRuntimeCheckException new];
+ runtimeCheckException.exception = @"We highly recommend you to set pageName.\n call WXSDKInstance * instance = [WXSDKInstance new]; instance.page = @\"your page name\" to fix it";
+ [jsExceptionHandler onRuntimeCheckException:runtimeCheckException];
+ }
}
WX_MONITOR_INSTANCE_PERF_START(WXPTFirstScreenRender, self);
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/72f9dc47/ios/sdk/WeexSDK/Sources/Protocol/WXJSExceptionProtocol.h
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Protocol/WXJSExceptionProtocol.h b/ios/sdk/WeexSDK/Sources/Protocol/WXJSExceptionProtocol.h
index fbb2630..dd91aed 100644
--- a/ios/sdk/WeexSDK/Sources/Protocol/WXJSExceptionProtocol.h
+++ b/ios/sdk/WeexSDK/Sources/Protocol/WXJSExceptionProtocol.h
@@ -19,6 +19,8 @@
#import "WXJSExceptionInfo.h"
+typedef WXJSExceptionInfo WXRuntimeCheckException;
+
@protocol WXJSExceptionProtocol <NSObject>
/**
@@ -29,4 +31,12 @@
- (void)onJSException:(WXJSExceptionInfo*) exception;
+
+@optional
+
+/**
+ * report runtime check exception, this is optional for this protocol
+ */
+- (void)onRuntimeCheckException:(WXRuntimeCheckException*)exception;
+
@end
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/72f9dc47/ios/sdk/WeexSDK/Sources/Utility/WXAssert.h
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Utility/WXAssert.h b/ios/sdk/WeexSDK/Sources/Utility/WXAssert.h
index 70fa29b..9ebba75 100644
--- a/ios/sdk/WeexSDK/Sources/Utility/WXAssert.h
+++ b/ios/sdk/WeexSDK/Sources/Utility/WXAssert.h
@@ -41,9 +41,6 @@ do{\
#define WXAssertParam(name) WXAssert(name, \
@"the parameter '%s' is required", #name)
-#define WXAssertCondition(condition, param) WXAssert(condition, \
-@"the parameter '%s' is required", #param)
-
/**
* @abstract macro for asserting if the handler conforms to the protocol
*/