Why is there a try! in the codebase?

Open
#1,290 4 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
45/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale
Tech stack
sqlite, swift
Domain
databases

Research direction

Start in Core/Statement.swift and inspect the try! involved when db.prepare is called. Reproduce the reported crash with SQLite.swift 0.15.3 through Swift Package Manager, then verify that the throwable path reports an error that callers can catch or ignore instead of fatally terminating the app.

Written by the indexing model from the issue text.

Description

Build Information

  • Include the SQLite.swift version, commit or branch experiencing the issue.
    0.15.3

  • Mention Xcode and OS X versions affected.
    All

  • How do do you integrate SQLite.swift in your project?

    • Swift Package manager

General guidelines

In Core/Statement.swift, this try! causes a crash on some of my users:
Screenshot 2024-12-16 at 6 22 00 PM

It happens when trying db.prepare. When the function is already throwable, it should be expected that it never fatally crashes the app, but rather throw an error which I could either catch or ignore.
Screenshot 2024-12-16 at 6 28 32 PM

That way I could act on the error. Otherwise this is not good for the UX. Would really appreciate any help!

Dominant language
Swift
Stars
10.2k
Forks
1.6k
Avg merge
6d 2h
Merged PRs (30d)
2

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from stephencelis/SQLite.swift

All issues in stephencelis/SQLite.swift

Similar issues

More Swift issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.