mirror of
https://github.com/fafhrd91/actix-web
synced 2025-06-25 06:39:22 +02:00
Implement std::error::Error
for our custom errors
For allowing a more ergonomic use and better integration on the ecosystem, this adds the `std::error::Error` `impl` for our custom errors. We intent to drop this hand made code once `derive_more` finishes the addition of the Error derive support[1]. Until that is available, we need to live with that. 1. https://github.com/JelteF/derive_more/issues/92 Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
This commit is contained in:
@ -1,5 +1,13 @@
|
||||
# Changes
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
### Changed
|
||||
|
||||
* Implement `std::error::Error` for our custom errors [#1422]
|
||||
|
||||
[#1422]: https://github.com/actix/actix-web/pull/1422
|
||||
|
||||
## [2.0.0-alpha.1] - 2020-03-11
|
||||
|
||||
* Update `actix-http` dependency to 2.0.0-alpha.2
|
||||
|
@ -42,6 +42,8 @@ pub enum WsClientError {
|
||||
SendRequest(SendRequestError),
|
||||
}
|
||||
|
||||
impl std::error::Error for WsClientError {}
|
||||
|
||||
impl From<InvalidUrl> for WsClientError {
|
||||
fn from(err: InvalidUrl) -> Self {
|
||||
WsClientError::SendRequest(err.into())
|
||||
@ -68,5 +70,7 @@ pub enum JsonPayloadError {
|
||||
Payload(PayloadError),
|
||||
}
|
||||
|
||||
impl std::error::Error for JsonPayloadError {}
|
||||
|
||||
/// Return `InternalServerError` for `JsonPayloadError`
|
||||
impl ResponseError for JsonPayloadError {}
|
||||
|
Reference in New Issue
Block a user