mirror of
https://github.com/groue/GRDB.swift
synced 2026-11-25 04:07:47 +00:00
Have DatabaseError adopt CustomNSError
This commit is contained in:
1 parent
43d4d3cddc
commit
7058bb5e12
1 file changed
+20
@@ -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]
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user