Skip to content

Error classification substring-matches reqwest Debug output; fragile across dependency bumps #480

@barjin

Description

@barjin

🤖 Found by Claude ultrareview — automated high-effort code review. Please verify independently before acting.

Location: impit/src/errors.rs:115 and :125 (ImpitError::from)

Connect-timeout and incomplete-body classification relies on substring-matching the reqwest error's Debug output:

... format!("{:?}", error).to_lowercase().contains("connection timed out") ...
... format!("{:?}", error).to_lowercase().contains("unexpectedeof") ...

Impact: the Debug formatting of hyper/reqwest internal error types is not a stable API. A dependency bump can change the string, after which every connect-timeout silently downgrades to a generic TimeoutException and every truncated response to a generic error — defeating the typed error hierarchy callers rely on. The is_incomplete_message() downcast used just above shows the robust approach is available; it just isn't used consistently.

Suggested direction: classify via typed downcasts / is_* accessors on the error chain instead of stringly-matching Debug output.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working.rustThis issue concerns the Rust part of this monorepo.t-toolingIssues with this label are in the ownership of the tooling team.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions