diff options
author | Luca Casonato <hello@lcas.dev> | 2024-09-27 16:07:20 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-27 14:07:20 +0000 |
commit | 3134abefa462ead8bb8e2e4aa8a5b57910f3d430 (patch) | |
tree | 0f01cca8ca91ea6fb06347f17a77091259749c28 /ext/net/ops_tls.rs | |
parent | 88a4f8dd97704b8905d05def949b137a75286b18 (diff) |
BREAKING(ext/net): improved error code accuracy (#25383)
Co-authored-by: Bartek IwaĆczuk <biwanczuk@gmail.com>
Diffstat (limited to 'ext/net/ops_tls.rs')
-rw-r--r-- | ext/net/ops_tls.rs | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/ext/net/ops_tls.rs b/ext/net/ops_tls.rs index 064da5818..5bc04ceb5 100644 --- a/ext/net/ops_tls.rs +++ b/ext/net/ops_tls.rs @@ -298,10 +298,10 @@ where .resource_table .take::<TcpStreamResource>(rid)?; // This TCP connection might be used somewhere else. If it's the case, we cannot proceed with the - // process of starting a TLS connection on top of this TCP connection, so we just return a bad - // resource error. See also: https://github.com/denoland/deno/pull/16242 + // process of starting a TLS connection on top of this TCP connection, so we just return a Busy error. + // See also: https://github.com/denoland/deno/pull/16242 let resource = Rc::try_unwrap(resource_rc) - .map_err(|_| bad_resource("TCP stream is currently in use"))?; + .map_err(|_| custom_error("Busy", "TCP stream is currently in use"))?; let (read_half, write_half) = resource.into_inner(); let tcp_stream = read_half.reunite(write_half)?; @@ -526,7 +526,6 @@ pub async fn op_net_accept_tls( match listener.accept().try_or_cancel(&cancel_handle).await { Ok(tuple) => tuple, Err(err) if err.kind() == ErrorKind::Interrupted => { - // FIXME(bartlomieju): compatibility with current JS implementation. return Err(bad_resource("Listener has been closed")); } Err(err) => return Err(err.into()), |