No `NSError *` over the bridge
Summary: I was getting the following error when running `testAsyncStorageTest` ``` uncaught exception 'NSInvalidArgumentException', reason: 'Invalid type in JSON write (NSError)' ``` nicklockwood pointed out that it might be because we're attempting to send a `NSError *` over the bridge at some point. So I went looking for cases where that might happen and found this instance. public Reviewed By: jingc Differential Revision: D2619240 fb-gh-sync-id: dc26ec268f976fec44f2804831398d3b01ab6115
This commit is contained in:
parent
575a4a71b9
commit
a4cc0c3ffd
|
@ -123,12 +123,12 @@ static dispatch_queue_t RCTGetMethodQueue()
|
|||
}
|
||||
|
||||
static BOOL RCTHasCreatedStorageDirectory = NO;
|
||||
static NSError *RCTDeleteStorageDirectory()
|
||||
static NSDictionary *RCTDeleteStorageDirectory()
|
||||
{
|
||||
NSError *error;
|
||||
[[NSFileManager defaultManager] removeItemAtPath:RCTGetStorageDirectory() error:&error];
|
||||
RCTHasCreatedStorageDirectory = NO;
|
||||
return error;
|
||||
return error ? RCTMakeError(@"Failed to delete storage directory.", error, nil) : nil;
|
||||
}
|
||||
|
||||
#pragma mark - RCTAsyncLocalStorage
|
||||
|
@ -378,7 +378,7 @@ RCT_EXPORT_METHOD(multiRemove:(NSStringArray *)keys
|
|||
RCT_EXPORT_METHOD(clear:(RCTResponseSenderBlock)callback)
|
||||
{
|
||||
_manifest = [NSMutableDictionary new];
|
||||
NSError *error = RCTDeleteStorageDirectory();
|
||||
NSDictionary *error = RCTDeleteStorageDirectory();
|
||||
callback(@[RCTNullIfNil(error)]);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue