Skip to content

false "Errors thrown from here are not handled" #1098

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
nh7a opened this issue May 1, 2025 · 0 comments
Open

false "Errors thrown from here are not handled" #1098

nh7a opened this issue May 1, 2025 · 0 comments
Labels
bug 🪲 Something isn't working

Comments

@nh7a
Copy link

nh7a commented May 1, 2025

Description

Build failure due to "Errors thrown from here are not handled" occurs depending on the following line of code.

Reproduction

@Test func myTest() throws {
  let db = AppDatabase().mock()
  try db.reader.read { ctx in
    #expect(try MyModel.fetchCount(ctx) == 0)  // ❌ Errors thrown from here are not handled
  }
}
@Test func myTest() throws {
  let db = AppDatabase().mock()
  try db.reader.read { ctx in
    #expect(try MyModel.fetchCount(ctx) == 0)  // ✅
    let count = try MyModel.fetchCount(ctx)
    #expect(count == 0)
  }
}

Expected behavior

It has to build without an error.

Environment

swift-driver version: 1.120.5 Apple Swift version 6.1 (swiftlang-6.1.0.110.21 clang-1700.0.13.3)
Target: arm64-apple-macosx15.0

Darwin nh7a 24.4.0 Darwin Kernel Version 24.4.0: Fri Apr 11 18:33:47 PDT 2025; root:xnu-11417.101.15~117/RELEASE_ARM64_T6030 arm64

Additional information

No response

@nh7a nh7a added bug 🪲 Something isn't working triage-needed labels May 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🪲 Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants