Have DatabaseError adopt CustomNSError

This commit is contained in:
Gwendal Roué committed 2016-10-18 05:49:12 +02:00
1 parent 43d4d3cddc
commit 7058bb5e12
1 file changed
+20
+20
View File
@@ -1,3 +1,5 @@
import Foundation
#if !USING_BUILTIN_SQLITE
#if os(OSX)
import SQLiteMacOSX
@@ -59,3 +61,21 @@ extension DatabaseError: CustomStringConvertible {
return description
}
}
extension DatabaseError : CustomNSError {
/// NSError bridging: the domain of the error.
public static var errorDomain: String {
return "GRDB.DatabaseError"
}
/// NSError bridging: the error code within the given domain.
public var errorCode: Int {
return Int(code)
}
/// NSError bridging: the user-info dictionary.
public var errorUserInfo: [String : Any] {
return [NSLocalizedDescriptionKey: description]
}
}