feat: return 401 Unauthorized for rpc auth error

This commit is contained in:
danda 2025-01-22 22:20:51 -08:00
parent 8a79c578c2
commit 8694e03357

View File

@ -25,6 +25,9 @@ pub fn rpc_err(e: TarpcError) -> Response {
} }
pub fn rpc_method_err(e: RpcError) -> Response { pub fn rpc_method_err(e: RpcError) -> Response {
// todo: handle auth variant. let status_code = match e {
(StatusCode::BAD_REQUEST, format!("{:?}", e)).into_response() RpcError::Auth(_) => StatusCode::UNAUTHORIZED,
_ => StatusCode::BAD_REQUEST,
};
(status_code, format!("{:?}", e)).into_response()
} }