Skip to content

Commit

Permalink
refactor(ext/fetch): use concrete error types (#26220)
Browse files Browse the repository at this point in the history
  • Loading branch information
crowlKats authored Oct 19, 2024
1 parent d1cd1fa commit 6c4ef11
Show file tree
Hide file tree
Showing 6 changed files with 255 additions and 134 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions ext/fetch/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ percent-encoding.workspace = true
rustls-webpki.workspace = true
serde.workspace = true
serde_json.workspace = true
thiserror.workspace = true
tokio.workspace = true
tokio-rustls.workspace = true
tokio-socks.workspace = true
Expand Down
5 changes: 1 addition & 4 deletions ext/fetch/fs_fetch_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ use crate::CancelHandle;
use crate::CancelableResponseFuture;
use crate::FetchHandler;

use deno_core::error::type_error;
use deno_core::futures::FutureExt;
use deno_core::futures::TryFutureExt;
use deno_core::futures::TryStreamExt;
Expand Down Expand Up @@ -42,9 +41,7 @@ impl FetchHandler for FsFetchHandler {
.map_err(|_| ())?;
Ok::<_, ()>(response)
}
.map_err(move |_| {
type_error("NetworkError when attempting to fetch resource")
})
.map_err(move |_| super::FetchError::NetworkError)
.or_cancel(&cancel_handle)
.boxed_local();

Expand Down
Loading

0 comments on commit 6c4ef11

Please sign in to comment.