send strings instead of NSError over bridge, RCTBridge chokes sometimes on NSJSONSerialization of errors
This commit is contained in:
parent
5812536d1f
commit
f33fde4c06
|
@ -95,7 +95,8 @@ NSString *const RCTUDPErrorDomain = @"RCTUDPErrorDomain";
|
||||||
NSNumber* tagNum = [NSNumber numberWithLong:msgTag];
|
NSNumber* tagNum = [NSNumber numberWithLong:msgTag];
|
||||||
RCTResponseSenderBlock callback = [_pendingSends objectForKey:tagNum];
|
RCTResponseSenderBlock callback = [_pendingSends objectForKey:tagNum];
|
||||||
if (callback) {
|
if (callback) {
|
||||||
callback(@[error]);
|
NSString* msg = [[error userInfo] valueForKey:@"NSLocalizedFailureReason"];
|
||||||
|
callback(@[msg]);
|
||||||
[_pendingSends removeObjectForKey:tagNum];
|
[_pendingSends removeObjectForKey:tagNum];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,7 +50,8 @@ RCT_EXPORT_METHOD(bind:(nonnull NSNumber*)cId
|
||||||
NSError *error = nil;
|
NSError *error = nil;
|
||||||
if (![client bind:port address:address error:&error])
|
if (![client bind:port address:address error:&error])
|
||||||
{
|
{
|
||||||
callback(@[error]);
|
NSString* msg = [[error userInfo] valueForKey:@"NSLocalizedFailureReason"];
|
||||||
|
callback(@[msg]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,7 +92,8 @@ RCT_EXPORT_METHOD(setBroadcast:(nonnull NSNumber*)cId
|
||||||
NSError *error = nil;
|
NSError *error = nil;
|
||||||
if (![client setBroadcast:flag error:&error])
|
if (![client setBroadcast:flag error:&error])
|
||||||
{
|
{
|
||||||
callback(@[error]);
|
NSString* msg = [[error userInfo] valueForKey:@"NSLocalizedFailureReason"];
|
||||||
|
callback(@[msg]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
callback(@[[NSNull null]]);
|
callback(@[[NSNull null]]);
|
||||||
|
|
Loading…
Reference in New Issue