DatabaseError
public struct DatabaseError : Error
DatabaseError wraps an SQLite error.
-
The SQLite error code (see https://www.sqlite.org/rescode.html#primary_result_code_list).
do { ... } catch let error as DatabaseError where error.resultCode == .SQL_CONSTRAINT { // A constraint error }This property returns a
primary result code
, that is to say the least significant 8 bits of any SQLite result code. See https://www.sqlite.org/rescode.html for more information.See also
extendedResultCode.Declaration
Swift
public var resultCode: ResultCode -
The SQLite extended error code (see https://www.sqlite.org/rescode.html#extended_result_code_list).
do { ... } catch let error as DatabaseError where error.extendedResultCode == .SQLITE_CONSTRAINT_FOREIGNKEY { // A foreign key constraint error }See also
resultCode.Declaration
Swift
public let extendedResultCode: ResultCode -
The SQLite error message.
Declaration
Swift
public let message: String? -
The SQL query that yielded the error (if relevant).
Declaration
Swift
public let sql: String? -
Creates a Database Error
Declaration
Swift
public init(resultCode: ResultCode = .SQLITE_ERROR, message: String? = nil, sql: String? = nil, arguments: StatementArguments? = nil)
-
Declaration
Swift
public var description: String
-
NSError bridging: the domain of the error.
Declaration
Swift
public static var errorDomain: String -
NSError bridging: the error code within the given domain.
Declaration
Swift
public var errorCode: Int -
NSError bridging: the user-info dictionary.
Declaration
Swift
public var errorUserInfo: [String : Any]
View on GitHub
Install in Dash
DatabaseError Structure Reference