Browse Source

[Issue #668] Made the static error convenience functions public.

Christian Noon 10 years ago
parent
commit
85b90fe115
1 changed files with 18 additions and 2 deletions
  1. 18 2
      Source/Error.swift

+ 18 - 2
Source/Error.swift

@@ -39,11 +39,27 @@ public struct Error {
         case PropertyListSerializationFailed = -6007
     }
 
-    static func errorWithCode(code: Code, failureReason: String) -> NSError {
+    /**
+        Creates an `NSError` with the given error code and failure reason.
+
+        - parameter code:          The error code.
+        - parameter failureReason: The failure reason.
+
+        - returns: An `NSError` with the given error code and failure reason.
+    */
+    public static func errorWithCode(code: Code, failureReason: String) -> NSError {
         return errorWithCode(code.rawValue, failureReason: failureReason)
     }
 
-    static func errorWithCode(code: Int, failureReason: String) -> NSError {
+    /**
+        Creates an `NSError` with the given error code and failure reason.
+
+        - parameter code:          The error code.
+        - parameter failureReason: The failure reason.
+
+        - returns: An `NSError` with the given error code and failure reason.
+    */
+    public static func errorWithCode(code: Int, failureReason: String) -> NSError {
         let userInfo = [NSLocalizedFailureReasonErrorKey: failureReason]
         return NSError(domain: Domain, code: code, userInfo: userInfo)
     }