Skip to content

Commit 992a03e

Browse files
committed
优化错误处理逻辑,使用更简洁的 io::Error::other 方法替代 io::Error::new
1 parent 53157a1 commit 992a03e

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

rust_http_proxy/src/http1_client.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ where
207207
.await
208208
{
209209
Ok(s) => s,
210-
Err(err) => return Err(io::Error::new(ErrorKind::Other, err)),
210+
Err(err) => return Err(io::Error::other(err)),
211211
};
212212

213213
let access_label = access_label.clone();

rust_http_proxy/src/linux_axum_handler.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ pub async fn count_stream() -> Result<(HeaderMap, String), AppError> {
3232
debug!("ss command stdout: {}", stdout);
3333
if !stderr.is_empty() {
3434
warn!("ss command stderr: {}", stderr);
35-
return Err(AppError::new(io::Error::new(io::ErrorKind::Other, stderr)));
35+
return Err(AppError::new(io::Error::other(stderr)));
3636
}
3737

3838
// 解析 ss 命令输出

0 commit comments

Comments
 (0)