Skip to content

How to catch interrupted error? #1117

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

Closed
brookhong opened this issue Mar 13, 2022 · 2 comments
Closed

How to catch interrupted error? #1117

brookhong opened this issue Mar 13, 2022 · 2 comments

Comments

@brookhong
Copy link

Querying in some table is time-consuming, I want to intentionally interrupt previous query with db.interrupt(), which works fine.

But got below error from previous query, how can I catch the error without crashing the application?

SQLite/Statement.swift:211: Fatal error: 'try!' expression unexpectedly raised an error: interrupted (code: 9)

Tried below code, but to no avail.

    do {
        let sequences = try db.prepare(repos.select(key))
        rows = Array(sequences.enumerated())
    } catch {
        print(error)
    }
@SaladDays831
Copy link

Also happening to me when I call db.interrupt()
Crashes in Statement.swift, on

extension FailableIterator {
    public func next() -> Element? {
        // swiftlint:disable:next force_try
        try! failableNext()
    }
}

@nathanfallet
Copy link
Collaborator

Closing as it is a duplicate of #1118. We're going to keep only one issue opened to track this problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants