Skip to content
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

Review Ingestor/Analyzer error paths #62

Closed
finestructure opened this issue May 14, 2020 · 0 comments · Fixed by #72
Closed

Review Ingestor/Analyzer error paths #62

finestructure opened this issue May 14, 2020 · 0 comments · Fixed by #72
Assignees

Comments

@finestructure
Copy link
Member

I need to rework both stages around their error handling. There are still gaps where errors are not caught, for instance this test fails:

    func test_invalidPackageCachePath() throws {
        // setup
        try savePackages(on: app.db, ["1", "2"], processingStage: .ingestion)

        // MUT
        try analyze(application: app, limit: 10).wait()

        // validation
        let packages = try Package.query(on: app.db).sort(\.$url).all().wait()
        XCTAssertEqual(packages.map(\.status), [.invalidUrl, .invalidUrl])
    }

by raising an invalidPackageCachePath exception out of the analyze call that should not bubble up.

In practise this might not happen, because an invalid url like that doesn't get this far in the chain. However, both stages, suffer from being written in the first few days and contain a mix of throwing and Result code which is hard to reason about.

Explore rewriting everthing around Result, if possible.

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

Successfully merging a pull request may close this issue.

1 participant