mirror of
https://github.com/groue/GRDB.swift
synced 2026-11-25 04:07:47 +00:00
RecordError DocC
This commit is contained in:
1 parent
397a008237
commit
840fa3b5da
1 file changed
+25
@@ -669,6 +669,31 @@ extension TableRecord {
|
||||
// MARK: - RecordError
|
||||
|
||||
/// A record error.
|
||||
///
|
||||
/// `RecordError` is thrown by ``MutablePersistableRecord`` types when an
|
||||
/// `update` method could not find any row to update:
|
||||
///
|
||||
/// ```swift
|
||||
/// do {
|
||||
/// try player.update(db)
|
||||
/// } catch let RecordError.recordNotFound(databaseTableName: table, key: key) {
|
||||
/// print("Key \(key) was not found in table \(table).")
|
||||
/// }
|
||||
/// ```
|
||||
///
|
||||
/// `RecordError` is also thrown by ``FetchableRecord`` types when a
|
||||
/// `find` method does not find any record:
|
||||
///
|
||||
/// ```swift
|
||||
/// do {
|
||||
/// let player = try Player.find(db, id: 42)
|
||||
/// } catch let RecordError.recordNotFound(databaseTableName: table, key: key) {
|
||||
/// print("Key \(key) was not found in table \(table).")
|
||||
/// }
|
||||
/// ```
|
||||
///
|
||||
/// You can create `RecordError` instances with the
|
||||
/// ``TableRecord/recordNotFound(_:id:)`` method and its variants.
|
||||
public enum RecordError: Error {
|
||||
/// A record does not exist in the database.
|
||||
///
|
||||
|
||||
Reference in new issue
Block a user