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

Change compression body error type to BoxError #107

Closed
wants to merge 1 commit into from

Conversation

davidpdrsn
Copy link
Member

@davidpdrsn davidpdrsn commented Jun 4, 2021

The compression related middleware would previously use BodyOrIoError
as the body error type. That only implemented std::error::Error if the
inner error did as well. Since Box<dyn std::error::Error + Send + Sync>
does not implement std::error::Error Compression and
Decompression wouldn't be usable with hyper if the body they wrapped
had that error type.

This changes the middleware to use BoxError as the error type which
resolves the issue. Its also consistent with other middleware.

Note: This is a breaking change so should be released in 0.2 when we decide to do that.

@davidpdrsn davidpdrsn added C-enhancement Category: A PR with an enhancement or a proposed on in an issue. breaking change A PR that makes a breaking change. labels Jun 4, 2021
@davidpdrsn davidpdrsn added this to the 0.2.0 milestone Jun 4, 2021
The compression related middleware would previously use `BodyOrIoError`
as the error type. That only implemented `std::error::Error` if the
inner error did as well. Since `Box<dyn std::error::Error + Send +
Sync>` does not implement `std::error::Error` `Compression` and
`Decompression` wouldn't be usable with hyper if the body they wrapped
had that error type.

This changes the middleware to use `BoxError` as the error type which
resolves the issue. Its also consistent with other middleware.

Note: This is a breaking change!
@davidpdrsn davidpdrsn force-pushed the change-compression-error-type branch from 44a8608 to beeb318 Compare June 4, 2021 19:41
davidpdrsn added a commit that referenced this pull request Nov 15, 2021
The compression related middleware would previously use `BodyOrIoError`
as the body error type. That only implemented `std::error::Error` if the
inner error did as well. Since `Box<dyn std::error::Error + Send + Sync>`
does not implement `std::error::Error` `Compression` and
`Decompression` wouldn't be usable with hyper if the body they wrapped
had that error type.

This changes the middleware to use `BoxError` as the error type which
resolves the issue. Its also consistent with other middleware.

Reimplementation of #107 on top of latest `master`.
@davidpdrsn
Copy link
Member Author

Superseded by #166

@davidpdrsn davidpdrsn closed this Nov 15, 2021
@davidpdrsn davidpdrsn deleted the change-compression-error-type branch November 15, 2021 11:16
davidpdrsn added a commit that referenced this pull request Nov 15, 2021
* Change compression body error type to `BoxError`

The compression related middleware would previously use `BodyOrIoError`
as the body error type. That only implemented `std::error::Error` if the
inner error did as well. Since `Box<dyn std::error::Error + Send + Sync>`
does not implement `std::error::Error` `Compression` and
`Decompression` wouldn't be usable with hyper if the body they wrapped
had that error type.

This changes the middleware to use `BoxError` as the error type which
resolves the issue. Its also consistent with other middleware.

Reimplementation of #107 on top of latest `master`.

* changelog

* fix doc tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking change A PR that makes a breaking change. C-enhancement Category: A PR with an enhancement or a proposed on in an issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant