Skip to content

Commit

Permalink
#trivial print exception if deserialization fails (#196)
Browse files Browse the repository at this point in the history
* print exception if deserialization fails

* change exception log to an assert, will crash in debug and not production
  • Loading branch information
justin1121 authored and garrettmoon committed Sep 18, 2017
1 parent f10c669 commit 3a95246
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Source/PINDiskCache.m
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
[[NSString stringWithUTF8String:__FILE__] lastPathComponent], \
__LINE__, [error localizedDescription]); }

#define PINDiskCacheException(exception) if (exception) { NSAssert(NO, [exception reason]); }

NSString * const PINDiskCachePrefix = @"com.pinterest.PINDiskCache";
static NSString * const PINDiskCacheSharedName = @"PINDiskCacheShared";

Expand Down Expand Up @@ -858,7 +860,8 @@ - (id)objectForKeyedSubscript:(NSString *)key
[self lock];
[[NSFileManager defaultManager] removeItemAtPath:[fileURL path] error:&error];
[self unlock];
PINDiskCacheError(error);
PINDiskCacheError(error)
PINDiskCacheException(exception);
}
[self lock];
}
Expand Down

0 comments on commit 3a95246

Please sign in to comment.