Skip to content

Commit

Permalink
Remove useless catch
Browse files Browse the repository at this point in the history
  • Loading branch information
MattiasBuelens committed Oct 7, 2023
1 parent af46fba commit 5c6b90c
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 11 deletions.
3 changes: 1 addition & 2 deletions src/readable/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
//! [readable streams](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream).
use futures_util::io::AsyncRead;
use futures_util::Stream;
use wasm_bindgen::JsCast;
use wasm_bindgen::prelude::*;
use wasm_bindgen::{throw_val, JsCast};

pub use byob_reader::ReadableStreamBYOBReader;
pub use default_reader::ReadableStreamDefaultReader;
Expand Down Expand Up @@ -74,7 +74,6 @@ impl ReadableStream {
source,
&strategy.into_raw().unchecked_into(),
)
.unwrap_or_else(|error| throw_val(error.into()))
.unchecked_into();
Self { raw }
}
Expand Down
4 changes: 2 additions & 2 deletions src/readable/sys.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ extern "C" {
#[wasm_bindgen(js_name = ReadableStream, typescript_type = "ReadableStream")]
pub(crate) type ReadableStreamExt;

#[wasm_bindgen(constructor, catch, js_class = ReadableStream)]
#[wasm_bindgen(constructor, js_class = ReadableStream)]
pub(crate) fn new_with_into_underlying_source(
source: IntoUnderlyingSource,
strategy: &QueuingStrategy,
) -> Result<ReadableStreamExt, Error>;
) -> ReadableStreamExt;

#[wasm_bindgen(constructor, catch, js_class = ReadableStream)]
pub(crate) fn new_with_into_underlying_byte_source(
Expand Down
5 changes: 1 addition & 4 deletions src/writable/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

use futures_util::Sink;
use wasm_bindgen::prelude::*;
use wasm_bindgen::throw_val;

pub use default_writer::WritableStreamDefaultWriter;
pub use into_async_write::IntoAsyncWrite;
Expand Down Expand Up @@ -55,9 +54,7 @@ impl WritableStream {
let sink = IntoUnderlyingSink::new(Box::new(sink));
// Use the default queuing strategy (with a HWM of 1 chunk).
// We shouldn't set HWM to 0, since that would break piping to the writable stream.
let raw = sys::WritableStreamExt::new_with_into_underlying_sink(sink)
.unwrap_or_else(|error| throw_val(error.into()))
.unchecked_into();
let raw = sys::WritableStreamExt::new_with_into_underlying_sink(sink).unchecked_into();
WritableStream { raw }
}

Expand Down
5 changes: 2 additions & 3 deletions src/writable/sys.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
//! Raw bindings to JavaScript objects used
//! by a [`WritableStream`](https://developer.mozilla.org/en-US/docs/Web/API/WritableStream).
//! These are re-exported from [web-sys](https://docs.rs/web-sys/0.3.64/web_sys/struct.WritableStream.html).
use js_sys::Error;
use wasm_bindgen::prelude::*;
pub use web_sys::WritableStream;
pub use web_sys::WritableStreamDefaultWriter;
Expand All @@ -15,8 +14,8 @@ extern "C" {
#[derive(Clone, Debug)]
pub(crate) type WritableStreamExt;

#[wasm_bindgen(constructor, catch, js_class = WritableStream)]
#[wasm_bindgen(constructor, js_class = WritableStream)]
pub(crate) fn new_with_into_underlying_sink(
sink: IntoUnderlyingSink,
) -> Result<WritableStreamExt, Error>;
) -> WritableStreamExt;
}

0 comments on commit 5c6b90c

Please sign in to comment.