Skip to content

Commit 255f907

Browse files
committed
feat(errors): expose error enums (fixes hyperium#2462)
1 parent ed2fdb7 commit 255f907

File tree

12 files changed

+307
-166
lines changed

12 files changed

+307
-166
lines changed

src/body/length.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ impl DecodedLength {
4343
Ok(DecodedLength(len))
4444
} else {
4545
warn!("content-length bigger than maximum: {} > {}", len, MAX_LEN);
46-
Err(crate::error::Parse::TooLarge)
46+
Err(crate::error::Parse::new_too_large())
4747
}
4848
}
4949

src/client/dispatch.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ mod tests {
317317
.expect("fulfilled")
318318
.expect_err("promise should error");
319319
match (err.0.kind(), err.1) {
320-
(&crate::error::Kind::Canceled, Some(_)) => (),
320+
(&crate::error::Kind::Canceled(_), Some(_)) => (),
321321
e => panic!("expected Error::Cancel(_), found {:?}", e),
322322
}
323323
}

src/client/service.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ where
5555
fn poll_ready(&mut self, cx: &mut task::Context<'_>) -> Poll<Result<(), Self::Error>> {
5656
self.inner
5757
.poll_ready(cx)
58-
.map_err(|e| crate::Error::new(crate::error::Kind::Connect).with(e.into()))
58+
.map_err(|e| crate::Error::new_connect(e))
5959
}
6060

6161
fn call(&mut self, req: T) -> Self::Future {
@@ -76,7 +76,7 @@ where
7676
Err(e) => Err(e),
7777
},
7878
Err(e) => {
79-
let err = crate::Error::new(crate::error::Kind::Connect).with(e.into());
79+
let err = crate::Error::new_connect(e);
8080
Err(err)
8181
}
8282
}

0 commit comments

Comments
 (0)