Skip to content

feat: add compression not supported as enum error#774

Open
Its-Just-Nans wants to merge 4 commits intomasterfrom
compression-not-supported-as-error
Open

feat: add compression not supported as enum error#774
Its-Just-Nans wants to merge 4 commits intomasterfrom
compression-not-supported-as-error

Conversation

@Its-Just-Nans
Copy link
Copy Markdown
Member

fix #773

@Its-Just-Nans Its-Just-Nans self-assigned this Apr 10, 2026
@Its-Just-Nans Its-Just-Nans changed the title feat: add compression not supported as enum error feat: add compression not supported as enum error Apr 10, 2026
Copy link
Copy Markdown
Contributor

@amazon-q-developer amazon-q-developer bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR correctly adds a dedicated CompressionMethodNotSupported error variant to improve type safety and error handling. The implementation is complete with all necessary match arms updated and proper error message mapping. The changes follow the Conventional Commits standard and align with the issue requirements.


You can now have the agent implement changes and create commits directly on your pull request's source branch. Simply comment with /q followed by your request in natural language to ask the agent to make changes.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a specific CompressionMethodNotSupported variant to the ZipError enum, replacing generic UnsupportedArchive errors across the codebase. The review feedback recommends enhancing this new error variant by including the specific compression method ID as a field. This change would provide better diagnostic context to users and requires corresponding updates to the Display, Error, and io::Error conversion implementations to handle the new variant signature.

Comment on lines +231 to +232
if let CompressionMethod::Unsupported(_) = data.compression_method {
return Err(ZipError::UnsupportedArchive(
"Compression method not supported",
));
return Err(ZipError::CompressionMethodNotSupported);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Capture the unsupported compression method ID and pass it to the error variant for better diagnostics.

Suggested change
if let CompressionMethod::Unsupported(_) = data.compression_method {
return Err(ZipError::UnsupportedArchive(
"Compression method not supported",
));
return Err(ZipError::CompressionMethodNotSupported);
if let CompressionMethod::Unsupported(id) = data.compression_method {
return Err(ZipError::CompressionMethodNotSupported(id));
References
  1. When changing the type of a field, ensure all implementations that use this field are updated accordingly to avoid compilation errors.

src/result.rs Outdated
InvalidPassword,

/// Compression method not supported
CompressionMethodNotSupported,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you also expose the compression method used? Ideally in a way that we can both Display and read the compression number from. Otherwise we can't give the full information to the user.

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 this pull request may close these issues.

Structured error message for unsupported archive types

2 participants