mirror of
https://github.com/JohnEstropia/CoreStore.git
synced 2026-02-24 16:45:07 +01:00
Changed error-handling method to rely on new enum CoreStoreError instead of NSErrors
This commit is contained in:
@@ -52,7 +52,7 @@ import Foundation
|
||||
case .Success(let hasChanges):
|
||||
// hasChanges indicates if there were changes or not
|
||||
case .Failure(let error):
|
||||
// error is the NSError instance for the failure
|
||||
// error is a CoreStoreError enum value
|
||||
}
|
||||
}
|
||||
```
|
||||
@@ -65,9 +65,9 @@ public enum SaveResult {
|
||||
case Success(hasChanges: Bool)
|
||||
|
||||
/**
|
||||
`SaveResult.Failure` indicates that the `commit()` for the transaction failed. The associated object for this value is the related `NSError` instance.
|
||||
`SaveResult.Failure` indicates that the `commit()` for the transaction failed. The associated object for this value is a `CoreStoreError` enum value.
|
||||
*/
|
||||
case Failure(NSError)
|
||||
case Failure(CoreStoreError)
|
||||
|
||||
|
||||
// MARK: Internal
|
||||
@@ -77,20 +77,10 @@ public enum SaveResult {
|
||||
self = .Success(hasChanges: hasChanges)
|
||||
}
|
||||
|
||||
internal init(_ error: NSError) {
|
||||
internal init(_ error: CoreStoreError) {
|
||||
|
||||
self = .Failure(error)
|
||||
}
|
||||
|
||||
internal init(_ errorCode: CoreStoreErrorCode) {
|
||||
|
||||
self.init(errorCode, userInfo: nil)
|
||||
}
|
||||
|
||||
internal init(_ errorCode: CoreStoreErrorCode, userInfo: [NSObject: AnyObject]?) {
|
||||
|
||||
self.init(NSError(coreStoreErrorCode: errorCode, userInfo: userInfo))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user