Added RCT_DEBUG

This commit is contained in:
Nick Lockwood
2015-04-21 05:26:51 -07:00
parent b0348edcae
commit 8e15a0d5e7
14 changed files with 184 additions and 189 deletions

View File

@@ -9,6 +9,7 @@
#import "RCTExceptionsManager.h"
#import "RCTDefines.h"
#import "RCTLog.h"
#import "RCTRedBox.h"
#import "RCTRootView.h"
@@ -43,11 +44,10 @@ RCT_EXPORT_METHOD(reportUnhandledException:(NSString *)message
return;
}
#if DEBUG
[[RCTRedBox sharedInstance] showErrorMessage:message withStack:stack];
#else
if (RCT_DEBUG) {
[[RCTRedBox sharedInstance] showErrorMessage:message withStack:stack];
return;
}
static NSUInteger reloadRetries = 0;
const NSUInteger maxMessageLength = 75;
@@ -76,21 +76,14 @@ RCT_EXPORT_METHOD(reportUnhandledException:(NSString *)message
NSString *name = [@"Unhandled JS Exception: " stringByAppendingString:sanitizedMessage];
[NSException raise:name format:@"Message: %@, stack: %@", message, prettyStack];
}
#endif
}
RCT_EXPORT_METHOD(updateExceptionMessage:(NSString *)message
stack:(NSArray *)stack)
{
#if DEBUG
[[RCTRedBox sharedInstance] updateErrorMessage:message withStack:stack];
#endif
if (RCT_DEBUG) {
[[RCTRedBox sharedInstance] updateErrorMessage:message withStack:stack];
}
}
@end