Skip to content

Commit

Permalink
From Boxed ResponseError impl added (#3388)
Browse files Browse the repository at this point in the history
* From Boxed ResponseError impl added

* docs: update changelog

---------

Co-authored-by: Rob Ede <robjtede@icloud.com>
  • Loading branch information
nyzd and robjtede authored Jun 7, 2024
1 parent ebd8bb2 commit 85655f7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions actix-web/CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Unreleased

### Added

- Implement `From<Box<dyn ResponseError>>` for `Error`.

## 4.6.0

### Added
Expand Down
6 changes: 6 additions & 0 deletions actix-web/src/error/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,12 @@ impl<T: ResponseError + 'static> From<T> for Error {
}
}

impl From<Box<dyn ResponseError>> for Error {
fn from(value: Box<dyn ResponseError>) -> Self {
Error { cause: value }
}
}

impl From<Error> for Response<BoxBody> {
fn from(err: Error) -> Response<BoxBody> {
err.error_response().into()
Expand Down

0 comments on commit 85655f7

Please sign in to comment.