Skip to content

Commit

Permalink
feat(errors): expose error enums (fixes hyperium#2462)
Browse files Browse the repository at this point in the history
  • Loading branch information
nox committed Apr 16, 2021
1 parent ed2fdb7 commit d4d39d8
Show file tree
Hide file tree
Showing 12 changed files with 307 additions and 166 deletions.
2 changes: 1 addition & 1 deletion src/body/length.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ impl DecodedLength {
Ok(DecodedLength(len))
} else {
warn!("content-length bigger than maximum: {} > {}", len, MAX_LEN);
Err(crate::error::Parse::TooLarge)
Err(crate::error::Parse::new_too_large())
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/client/dispatch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ mod tests {
.expect("fulfilled")
.expect_err("promise should error");
match (err.0.kind(), err.1) {
(&crate::error::Kind::Canceled, Some(_)) => (),
(&crate::error::Kind::Canceled(_), Some(_)) => (),
e => panic!("expected Error::Cancel(_), found {:?}", e),
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/client/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ where
fn poll_ready(&mut self, cx: &mut task::Context<'_>) -> Poll<Result<(), Self::Error>> {
self.inner
.poll_ready(cx)
.map_err(|e| crate::Error::new(crate::error::Kind::Connect).with(e.into()))
.map_err(|e| crate::Error::new_connect(e))
}

fn call(&mut self, req: T) -> Self::Future {
Expand All @@ -76,7 +76,7 @@ where
Err(e) => Err(e),
},
Err(e) => {
let err = crate::Error::new(crate::error::Kind::Connect).with(e.into());
let err = crate::Error::new_connect(e);
Err(err)
}
}
Expand Down
Loading

0 comments on commit d4d39d8

Please sign in to comment.