Skip to content

Structured error message for unsupported archive types #773

@konstin

Description

@konstin

Is your feature request related to a problem? Please describe.

In uv, we'd like to display a good error message if the compression the archive has is not supported (https://github.com/astral-sh/uv/pull/18927/changes#diff-d7a5e3f14379361d2ee76f77503b8af335934628e56cefbd215f0b3254f51c72R114-R117), and that they need to use one of the support compression algorithms. Currently this requires sniffing the string value, and doesn't allow us telling the user which compression is used:

zip2/src/compression.rs

Lines 516 to 518 in cde9e1b

return Err(crate::result::ZipError::UnsupportedArchive(
"Compression method not supported",
));

Describe the solution you'd like

It would be great if there was a dedicated error variant with structured information about the compression format. The main catch is that the error enum is part of the public API sort this is effectively a breaking change, even if we keep the existing variant.

Describe alternatives you've considered
n/a

Additional context
n/a

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions