Error handling for concrete JS executor

Reviewed By: adamjernst

Differential Revision: D3235189

fb-gh-sync-id: a6d545a6b0b388c52305e2936371776d579460cd
fbshipit-source-id: a6d545a6b0b388c52305e2936371776d579460cd
This commit is contained in:
Pieter De Baets 2016-04-28 13:41:55 -07:00 committed by Facebook Github Bot 9
parent 41e89b4129
commit 26d0ce929f
2 changed files with 9 additions and 1 deletions

View File

@ -25,6 +25,14 @@ RCT_EXTERN NSString *const RCTJSCThreadName;
*/ */
RCT_EXTERN NSString *const RCTJavaScriptContextCreatedNotification; RCT_EXTERN NSString *const RCTJavaScriptContextCreatedNotification;
/**
* Create a NSError from a JSError object.
*
* If available, the error's userInfo property will contain the JS stacktrace under
* the RCTJSStackTraceKey key.
*/
RCT_EXTERN NSError *RCTNSErrorFromJSError(JSContextRef context, JSValueRef jsError);
/** /**
* Uses a JavaScriptCore context as the execution engine. * Uses a JavaScriptCore context as the execution engine.
*/ */

View File

@ -144,7 +144,7 @@ static NSString *RCTJSValueToJSONString(JSContextRef context, JSValueRef value,
return (__bridge_transfer NSString *)string; return (__bridge_transfer NSString *)string;
} }
static NSError *RCTNSErrorFromJSError(JSContextRef context, JSValueRef jsError) NSError *RCTNSErrorFromJSError(JSContextRef context, JSValueRef jsError)
{ {
NSMutableDictionary *errorInfo = [NSMutableDictionary new]; NSMutableDictionary *errorInfo = [NSMutableDictionary new];