Skip to content

Commit 0345ff6

Browse files
committed
Replace assert! with an error
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
1 parent c691145 commit 0345ff6

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/unix.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ pub struct Acquired {
2222

2323
impl Client {
2424
pub fn new(mut limit: usize) -> io::Result<Client> {
25-
assert!(limit <= 4096, "Can't have limit larger than 4096 since the pipe would block forever when writing to it");
25+
if limit > 4096 {
26+
return Err(io::Error::new(io::ErrorKind::Other, "Can't have limit larger than 4096 since the pipe would block forever when writing to it"));
27+
}
2628

2729
let client = unsafe { Client::mk()? };
2830

0 commit comments

Comments
 (0)