Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 13 additions & 6 deletions Sources/ErrorKit/BuiltInErrors/DatabaseError.swift
Original file line number Diff line number Diff line change
Expand Up @@ -148,12 +148,19 @@ public enum DatabaseError: Throwable, Catching {
bundle: .module
)
case .recordNotFound(let entity, let identifier):
let idMessage = identifier.map { " with ID \($0)" } ?? ""
return String(
localized: "BuiltInErrors.DatabaseError.recordNotFound",
defaultValue: "The \(entity) record\(idMessage) was not found in the database. Verify the details and try again.",
bundle: .module
)
if let identifier {
return String(
localized: "BuiltInErrors.DatabaseError.recordNotFoundWithID",
defaultValue: "The \(entity) record with ID \(identifier) was not found in the database. Verify the details and try again.",
bundle: .module
)
} else {
return String(
localized: "BuiltInErrors.DatabaseError.recordNotFound",
defaultValue: "The \(entity) record was not found in the database. Verify the details and try again.",
bundle: .module
)
}
case .generic(let userFriendlyMessage):
return userFriendlyMessage
case .caught(let error):
Expand Down
Loading