File tree Expand file tree Collapse file tree 2 files changed +7
-2
lines changed
Expand file tree Collapse file tree 2 files changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -54,11 +54,13 @@ final class CacheReader {
5454 if offsetInFile == endOffset {
5555 break
5656 } else if offsetInFile > endOffset {
57+ // The messages on disk are out of sync with our header data.
5758 throw CacheAdvanceError . fileCorrupted
5859 }
5960 }
6061 }
6162 if let endOffset = endOffset, offsetInFile != endOffset {
63+ // If we finished reading messages but our offset in the file is less (or greater) than our expected ending offset, our header data is incorrect.
6264 throw CacheAdvanceError . fileCorrupted
6365 }
6466 return encodedMessages
Original file line number Diff line number Diff line change @@ -34,7 +34,9 @@ final class ObjectiveC {
3434 SwiftTryCatch . try ( {
3535 result = . success( work ( ) )
3636 } , catch: { exception in
37- result = . failure( ObjectiveCError ( exception: exception) )
37+ result = . failure( ObjectiveCError (
38+ exceptionName: exception. name,
39+ reason: exception. reason) )
3840 } )
3941
4042 switch result {
@@ -51,5 +53,6 @@ struct ObjectiveCTryFailure: Error {}
5153
5254/// A `throw`able NSException.
5355struct ObjectiveCError : Error {
54- let exception : NSException
56+ let exceptionName : NSExceptionName
57+ let reason : String ?
5558}
You can’t perform that action at this time.
0 commit comments