Skip to content

feat: add compression not supported as enum error#774

Merged
Pr0methean merged 4 commits into
masterfrom
compression-not-supported-as-error
Apr 19, 2026
Merged

feat: add compression not supported as enum error#774
Pr0methean merged 4 commits into
masterfrom
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

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

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.

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.

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

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.

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 thread src/result.rs Outdated
Comment thread src/result.rs Outdated
Comment thread src/result.rs Outdated
Comment thread src/result.rs Outdated
Comment thread src/compression.rs Outdated
Comment thread src/read/readers.rs Outdated
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.

Comment thread 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.

@Pr0methean Pr0methean added this pull request to the merge queue Apr 19, 2026
Merged via the queue into master with commit 07702d4 Apr 19, 2026
133 checks passed
@Pr0methean Pr0methean deleted the compression-not-supported-as-error branch April 19, 2026 06:09
@Pr0methean Pr0methean mentioned this pull request Apr 19, 2026
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

3 participants