Skip to content

Commit 937beeb

Browse files
broadwaylambparkera
authored andcommitted
[Documentation] Add doc comments for Foundation errors (#845)
1 parent 02273a0 commit 937beeb

File tree

1 file changed

+110
-1
lines changed

1 file changed

+110
-1
lines changed

Foundation/FoundationErrors.swift

Lines changed: 110 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,167 @@
11
// This source file is part of the Swift.org open source project
22
//
3-
// Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
3+
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
44
// Licensed under Apache License v2.0 with Runtime Library Exception
55
//
66
// See http://swift.org/LICENSE.txt for license information
77
// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
88
//
99

10+
/// File-system operation attempted on non-existent file.
1011
public var NSFileNoSuchFileError: Int { return CocoaError.Code.fileNoSuchFile.rawValue }
12+
13+
/// Failure to get a lock on file.
1114
public var NSFileLockingError: Int { return CocoaError.Code.fileLocking.rawValue }
15+
16+
/// Read error, reason unknown.
1217
public var NSFileReadUnknownError: Int { return CocoaError.Code.fileReadUnknown.rawValue }
18+
19+
/// Read error because of a permission problem.
1320
public var NSFileReadNoPermissionError: Int { return CocoaError.Code.fileReadNoPermission.rawValue }
21+
22+
/// Read error because of an invalid file name.
1423
public var NSFileReadInvalidFileNameError: Int { return CocoaError.Code.fileReadInvalidFileName.rawValue }
24+
25+
/// Read error because of a corrupted file, bad format, or similar reason.
1526
public var NSFileReadCorruptFileError: Int { return CocoaError.Code.fileReadCorruptFile.rawValue }
27+
28+
/// Read error because no such file was found.
1629
public var NSFileReadNoSuchFileError: Int { return CocoaError.Code.fileReadNoSuchFile.rawValue }
30+
31+
/// Read error because the string encoding was not applicable.
32+
///
33+
/// Access the bad encoding from the `userInfo` dictionary using
34+
/// the `NSStringEncodingErrorKey` key.
1735
public var NSFileReadInapplicableStringEncodingError: Int { return CocoaError.Code.fileReadInapplicableStringEncoding.rawValue }
36+
37+
/// Read error because the specified URL scheme is unsupported.
1838
public var NSFileReadUnsupportedSchemeError: Int { return CocoaError.Code.fileReadUnsupportedScheme.rawValue }
39+
40+
/// Read error because the specified file was too large.
1941
public var NSFileReadTooLargeError: Int { return CocoaError.Code.fileReadTooLarge.rawValue }
42+
43+
/// Read error because the string coding of the file could not be determined.
2044
public var NSFileReadUnknownStringEncodingError: Int { return CocoaError.Code.fileReadUnknownStringEncoding.rawValue }
45+
46+
/// Write error, reason unknown.
2147
public var NSFileWriteUnknownError: Int { return CocoaError.Code.fileWriteUnknown.rawValue }
48+
49+
/// Write error because of a permission problem.
2250
public var NSFileWriteNoPermissionError: Int { return CocoaError.Code.fileWriteNoPermission.rawValue }
51+
52+
/// Write error because of an invalid file name.
2353
public var NSFileWriteInvalidFileNameError: Int { return CocoaError.Code.fileWriteInvalidFileName.rawValue }
54+
55+
/// Write error returned when `FileManager` class’s copy, move,
56+
/// and link methods report errors when the destination file already exists.
2457
public var NSFileWriteFileExistsError: Int { return CocoaError.Code.fileWriteFileExists.rawValue }
58+
59+
/// Write error because the string encoding was not applicable.
60+
///
61+
/// Access the bad encoding from the `userInfo` dictionary
62+
/// using the `NSStringEncodingErrorKey` key.
2563
public var NSFileWriteInapplicableStringEncodingError: Int { return CocoaError.Code.fileWriteInapplicableStringEncoding.rawValue }
64+
65+
/// Write error because the specified URL scheme is unsupported.
2666
public var NSFileWriteUnsupportedSchemeError: Int { return CocoaError.Code.fileWriteUnsupportedScheme.rawValue }
67+
68+
/// Write error because of a lack of disk space.
2769
public var NSFileWriteOutOfSpaceError: Int { return CocoaError.Code.fileWriteOutOfSpace.rawValue }
70+
71+
/// Write error because because the volume is read only.
2872
public var NSFileWriteVolumeReadOnlyError: Int { return CocoaError.Code.fileWriteVolumeReadOnly.rawValue }
73+
2974
public var NSFileManagerUnmountUnknownError: Int { return CocoaError.Code.fileManagerUnmountUnknown.rawValue }
75+
3076
public var NSFileManagerUnmountBusyError: Int { return CocoaError.Code.fileManagerUnmountBusy.rawValue }
77+
78+
/// Key-value coding validation error.
3179
public var NSKeyValueValidationError: Int { return CocoaError.Code.keyValueValidation.rawValue }
80+
81+
/// Formatting error (related to display of data).
3282
public var NSFormattingError: Int { return CocoaError.Code.formatting.rawValue }
83+
84+
/// The user cancelled the operation (for example, by pressing Command-period).
85+
///
86+
/// This code is for errors that do not require a dialog displayed and might be
87+
/// candidates for special-casing.
3388
public var NSUserCancelledError: Int { return CocoaError.Code.userCancelled.rawValue }
89+
90+
/// The feature is not supported, either because the file system
91+
/// lacks the feature, or required libraries are missing,
92+
/// or other similar reasons.
93+
///
94+
/// For example, some volumes may not support a Trash folder, so these methods
95+
/// will report failure by returning `false` or `nil` and
96+
/// an `NSError` with `NSFeatureUnsupportedError`.
3497
public var NSFeatureUnsupportedError: Int { return CocoaError.Code.featureUnsupported.rawValue }
98+
99+
/// Executable is of a type that is not loadable in the current process.
35100
public var NSExecutableNotLoadableError: Int { return CocoaError.Code.executableNotLoadable.rawValue }
101+
102+
/// Executable does not provide an architecture compatible with
103+
/// the current process.
36104
public var NSExecutableArchitectureMismatchError: Int { return CocoaError.Code.executableArchitectureMismatch.rawValue }
105+
106+
/// Executable has Objective-C runtime information incompatible
107+
/// with the current process.
37108
public var NSExecutableRuntimeMismatchError: Int { return CocoaError.Code.executableRuntimeMismatch.rawValue }
109+
110+
/// Executable cannot be loaded for some other reason, such as
111+
/// a problem with a library it depends on.
38112
public var NSExecutableLoadError: Int { return CocoaError.Code.executableLoad.rawValue }
113+
114+
/// Executable fails due to linking issues.
39115
public var NSExecutableLinkError: Int { return CocoaError.Code.executableLink.rawValue }
116+
117+
/// An error was encountered while parsing the property list.
40118
public var NSPropertyListReadCorruptError: Int { return CocoaError.Code.propertyListReadCorrupt.rawValue }
119+
120+
/// The version number of the property list is unable to be determined.
41121
public var NSPropertyListReadUnknownVersionError: Int { return CocoaError.Code.propertyListReadUnknownVersion.rawValue }
122+
123+
/// An stream error was encountered while reading the property list.
42124
public var NSPropertyListReadStreamError: Int { return CocoaError.Code.propertyListReadStream.rawValue }
125+
126+
/// An stream error was encountered while writing the property list.
43127
public var NSPropertyListWriteStreamError: Int { return CocoaError.Code.propertyListWriteStream.rawValue }
128+
44129
public var NSPropertyListWriteInvalidError: Int { return CocoaError.Code.propertyListWriteInvalid.rawValue }
130+
131+
/// The XPC connection was interrupted.
45132
public var NSXPCConnectionInterrupted: Int { return CocoaError.Code.xpcConnectionInterrupted.rawValue }
133+
134+
/// The XPC connection was invalid.
46135
public var NSXPCConnectionInvalid: Int { return CocoaError.Code.xpcConnectionInvalid.rawValue }
136+
137+
/// The XPC connection reply was invalid.
47138
public var NSXPCConnectionReplyInvalid: Int { return CocoaError.Code.xpcConnectionReplyInvalid.rawValue }
139+
140+
/// The item has not been uploaded to iCloud by another device yet.
141+
///
142+
/// When this error occurs, you do not need to ask the system
143+
/// to start downloading the item. The system will download the item as soon
144+
/// as it can. If you want to know when the item becomes available,
145+
/// use an `NSMetadataQuer`y object to monitor changes to the file’s URL.
48146
public var NSUbiquitousFileUnavailableError: Int { return CocoaError.Code.ubiquitousFileUnavailable.rawValue }
147+
148+
/// The item could not be uploaded to iCloud because it would make
149+
/// the account go over its quota.
49150
public var NSUbiquitousFileNotUploadedDueToQuotaError: Int { return CocoaError.Code.ubiquitousFileNotUploadedDueToQuota.rawValue }
151+
152+
/// Connecting to the iCloud servers failed.
50153
public var NSUbiquitousFileUbiquityServerNotAvailable: Int { return CocoaError.Code.ubiquitousFileUbiquityServerNotAvailable.rawValue }
154+
51155
public var NSUserActivityHandoffFailedError: Int { return CocoaError.Code.userActivityHandoffFailed.rawValue }
156+
52157
public var NSUserActivityConnectionUnavailableError: Int { return CocoaError.Code.userActivityConnectionUnavailable.rawValue }
158+
53159
public var NSUserActivityRemoteApplicationTimedOutError: Int { return CocoaError.Code.userActivityRemoteApplicationTimedOut.rawValue }
160+
54161
public var NSUserActivityHandoffUserInfoTooLargeError: Int { return CocoaError.Code.userActivityHandoffUserInfoTooLarge.rawValue }
162+
55163
public var NSCoderReadCorruptError: Int { return CocoaError.Code.coderReadCorrupt.rawValue }
164+
56165
public var NSCoderValueNotFoundError: Int { return CocoaError.Code.coderValueNotFound.rawValue }
57166

58167
#if os(OSX) || os(iOS)

0 commit comments

Comments
 (0)