Fix: DatabaseQueue.read is throws, not rethrows

This commit is contained in:
Gwendal Roué committed 2021-02-20 11:55:19 +01:00
1 parent 8c8a25a73b
commit a681ccf2b9
4 files changed
+6 -4

No files matched your search

+2
View File
@@ -82,6 +82,8 @@ GRDB adheres to [Semantic Versioning](https://semver.org/), with one exception:
The [Common Table Expressions Guide](Documentation/CommonTableExpressions.md) was updated accordingly.
- **Fixed**: `DatabaseQueue.read` is now declared `throws` instead of `rethrows`.
## 5.4.0
Released February 15, 2021 • [diff](https://github.com/groue/GRDB.swift/compare/v5.3.0...v5.4.0)
+1 -1
View File
@@ -190,7 +190,7 @@ extension DatabaseQueue {
///
/// - parameter block: A block that accesses the database.
/// - throws: The error thrown by the block.
public func read<T>(_ block: (Database) throws -> T) rethrows -> T {
public func read<T>(_ block: (Database) throws -> T) throws -> T {
try writer.sync { db in
try db.readOnly { try block(db) }
}
+2 -2
View File
@@ -135,7 +135,7 @@ class DatabaseQueueTests: GRDBTestCase {
try dbQueue.write { _ in
dispatchPrecondition(condition: .onQueue(targetQueue))
}
dbQueue.read { _ in
try dbQueue.read { _ in
dispatchPrecondition(condition: .onQueue(targetQueue))
}
}
@@ -185,7 +185,7 @@ class DatabaseQueueTests: GRDBTestCase {
try dbQueue.write { _ in
dispatchPrecondition(condition: .onQueue(targetQueue))
}
dbQueue.read { _ in
try dbQueue.read { _ in
dispatchPrecondition(condition: .onQueue(targetQueue))
}
}
+1 -1
View File
@@ -378,7 +378,7 @@ class DatabaseTests : GRDBTestCase {
func testMaximumStatementArgumentCount() throws {
let dbQueue = try makeDatabaseQueue()
let count = dbQueue.read { $0.maximumStatementArgumentCount }
let count = try dbQueue.read { $0.maximumStatementArgumentCount }
// 999 should be safe: https://www.sqlite.org/limits.html
XCTAssertGreaterThanOrEqual(count, 999)
}