Skip to content

Commit

Permalink
fix(ios): handle when throwing new obj-c proxy error without subreason
Browse files Browse the repository at this point in the history
  • Loading branch information
sgtcoolguy committed Dec 4, 2019
1 parent e56abfc commit 3e2934b
Showing 1 changed file with 22 additions and 8 deletions.
30 changes: 22 additions & 8 deletions iphone/TitaniumKit/TitaniumKit/Sources/API/ObjcProxy.m
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,17 @@ @implementation ObjcProxy
+ (JSValue *)createError:(NSString *)reason subreason:(NSString *)subreason location:(NSString *)location inContext:(JSContext *)context
{
NSString *exceptionName = @"org.appcelerator";
NSDictionary *details = @{
kTiExceptionSubreason : subreason,
kTiExceptionLocation : location
};
NSDictionary *details;
if (subreason != nil) {
details = @{
kTiExceptionSubreason : subreason,
kTiExceptionLocation : location
};
} else {
details = @{
kTiExceptionLocation : location
};
}
NSException *exc = [NSException exceptionWithName:exceptionName reason:reason userInfo:details];
JSGlobalContextRef jsContext = [context JSGlobalContextRef];
JSValueRef jsValueRef = TiBindingTiValueFromNSObject(jsContext, exc);
Expand All @@ -29,10 +36,17 @@ + (JSValue *)createError:(NSString *)reason subreason:(NSString *)subreason loca
- (JSValue *)createError:(NSString *)reason subreason:(NSString *)subreason location:(NSString *)location inContext:(JSContext *)context
{
NSString *exceptionName = [@"org.appcelerator." stringByAppendingString:NSStringFromClass([self class])];
NSDictionary *details = @{
kTiExceptionSubreason : subreason,
kTiExceptionLocation : location
};
NSDictionary *details;
if (subreason != nil) {
details = @{
kTiExceptionSubreason : subreason,
kTiExceptionLocation : location
};
} else {
details = @{
kTiExceptionLocation : location
};
}
NSException *exc = [NSException exceptionWithName:exceptionName reason:reason userInfo:details];
JSGlobalContextRef jsContext = [context JSGlobalContextRef];
JSValueRef jsValueRef = TiBindingTiValueFromNSObject(jsContext, exc);
Expand Down

0 comments on commit 3e2934b

Please sign in to comment.