forked from swiftlang/swift
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Factor _NSCocoaError into a struct whose values are split across fram…
…eworks. The Cocoa error domain is comprised on error codes from Foundation, CoreData, and AppKit. Rather than try to collect all of the error codes into a single enum in Foundation, use a struct that conforms to ErrorType. Part of rdar://problem/20536610. Swift SVN r28755
- Loading branch information
1 parent
def3b0d
commit bddf134
Showing
6 changed files
with
141 additions
and
120 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
public extension _NSCocoaError { | ||
static let TextReadInapplicableDocumentTypeError = _NSCocoaError(rawValue: 65806) | ||
static let TextWriteInapplicableDocumentTypeError = _NSCocoaError(rawValue: 66062) | ||
static let ServiceApplicationNotFoundError = _NSCocoaError(rawValue: 66560) | ||
static let ServiceApplicationLaunchFailedError = _NSCocoaError(rawValue: 66561) | ||
static let ServiceRequestTimedOutError = _NSCocoaError(rawValue: 66562) | ||
static let ServiceInvalidPasteboardDataError = _NSCocoaError(rawValue: 66563) | ||
static let ServiceMalformedServiceDictionaryError = _NSCocoaError(rawValue: 66564) | ||
static let ServiceMiscellaneousError = _NSCocoaError(rawValue: 66800) | ||
static let SharingServiceNotConfiguredError = _NSCocoaError(rawValue: 67072) | ||
|
||
public var isServiceError: Bool { | ||
return rawValue >= 66560 && rawValue <= 66817; | ||
} | ||
|
||
public var isSharingServiceError: Bool { | ||
return rawValue >= 67072 && rawValue <= 67327; | ||
} | ||
|
||
public var isTextReadWriteError: Bool { | ||
return rawValue >= 65792 && rawValue <= 66303; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
add_swift_library(swiftCoreData IS_SDK_OVERLAY | ||
CoreData.swift | ||
|
||
SWIFT_MODULE_DEPENDS Foundation) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
@exported import CoreData | ||
import Foundation | ||
|
||
public extension _NSCocoaError { | ||
static let ManagedObjectValidationError = _NSCocoaError(rawValue: 1550) | ||
static let ValidationMultipleErrorsError = _NSCocoaError(rawValue: 1560) | ||
static let ValidationMissingMandatoryPropertyError = _NSCocoaError(rawValue: 1570) | ||
static let ValidationRelationshipLacksMinimumCountError = _NSCocoaError(rawValue: 1580) | ||
static let ValidationRelationshipExceedsMaximumCountError = _NSCocoaError(rawValue: 1590) | ||
static let ValidationRelationshipDeniedDeleteError = _NSCocoaError(rawValue: 1600) | ||
static let ValidationNumberTooLargeError = _NSCocoaError(rawValue: 1610) | ||
static let ValidationNumberTooSmallError = _NSCocoaError(rawValue: 1620) | ||
static let ValidationDateTooLateError = _NSCocoaError(rawValue: 1630) | ||
static let ValidationDateTooSoonError = _NSCocoaError(rawValue: 1640) | ||
static let ValidationInvalidDateError = _NSCocoaError(rawValue: 1650) | ||
static let ValidationStringTooLongError = _NSCocoaError(rawValue: 1660) | ||
static let ValidationStringTooShortError = _NSCocoaError(rawValue: 1670) | ||
static let ValidationStringPatternMatchingError = _NSCocoaError(rawValue: 1680) | ||
static let ManagedObjectContextLockingError = _NSCocoaError(rawValue: 132000) | ||
static let PersistentStoreCoordinatorLockingError = _NSCocoaError(rawValue: 132010) | ||
static let ManagedObjectReferentialIntegrityError = _NSCocoaError(rawValue: 133000) | ||
static let ManagedObjectExternalRelationshipError = _NSCocoaError(rawValue: 133010) | ||
static let ManagedObjectMergeError = _NSCocoaError(rawValue: 133020) | ||
static let ManagedObjectConstraintMergeError = _NSCocoaError(rawValue: 133021) | ||
static let PersistentStoreInvalidTypeError = _NSCocoaError(rawValue: 134000) | ||
static let PersistentStoreTypeMismatchError = _NSCocoaError(rawValue: 134010) | ||
static let PersistentStoreIncompatibleSchemaError = _NSCocoaError(rawValue: 134020) | ||
static let PersistentStoreSaveError = _NSCocoaError(rawValue: 134030) | ||
static let PersistentStoreIncompleteSaveError = _NSCocoaError(rawValue: 134040) | ||
static let PersistentStoreSaveConflictsError = _NSCocoaError(rawValue: 134050) | ||
static let CoreDataError = _NSCocoaError(rawValue: 134060) | ||
static let PersistentStoreOperationError = _NSCocoaError(rawValue: 134070) | ||
static let PersistentStoreOpenError = _NSCocoaError(rawValue: 134080) | ||
static let PersistentStoreTimeoutError = _NSCocoaError(rawValue: 134090) | ||
static let PersistentStoreUnsupportedRequestTypeError = _NSCocoaError(rawValue: 134091) | ||
static let PersistentStoreIncompatibleVersionHashError = _NSCocoaError(rawValue: 134100) | ||
static let MigrationError = _NSCocoaError(rawValue: 134110) | ||
static let MigrationCancelledError = _NSCocoaError(rawValue: 134120) | ||
static let MigrationMissingSourceModelError = _NSCocoaError(rawValue: 134130) | ||
static let MigrationMissingMappingModelError = _NSCocoaError(rawValue: 134140) | ||
static let MigrationManagerSourceStoreError = _NSCocoaError(rawValue: 134150) | ||
static let MigrationManagerDestinationStoreError = _NSCocoaError(rawValue: 134160) | ||
static let EntityMigrationPolicyError = _NSCocoaError(rawValue: 134170) | ||
static let SQLiteError = _NSCocoaError(rawValue: 134180) | ||
static let InferredMappingModelError = _NSCocoaError(rawValue: 134190) | ||
static let ExternalRecordImportError = _NSCocoaError(rawValue: 134200) | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters