Skip to content

Commit f3f947b

Browse files
committed
Fix wasm32 builds
1 parent f7f1607 commit f3f947b

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/wasm32_bindgen.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,13 +79,13 @@ fn getrandom_init() -> Result<RngSource, Error> {
7979
// we're in an older web browser and the OS RNG isn't available.
8080
let crypto = this.crypto();
8181
if crypto.is_undefined() {
82-
return Err(Error::from_custom_error(CRYPTO_UNDEF));
82+
return Err(Error::internal(BINDGEN_CRYPTO_UNDEF));
8383
}
8484

8585
// Test if `crypto.getRandomValues` is undefined as well
8686
let crypto: BrowserCrypto = crypto.into();
8787
if crypto.get_random_values_fn().is_undefined() {
88-
return Err(Error::from_custom_error(GRV_UNDEF));
88+
return Err(Error::internal(BINDGEN_GRV_UNDEF));
8989
}
9090

9191
// Ok! `self.crypto.getRandomValues` is a defined value, so let's

src/wasm32_stdweb.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ fn getrandom_init() -> Result<RngSource, Error> {
6969
} else {
7070
let err: WebError = js! { return @{ result }.error }.try_into().unwrap();
7171
error!("getrandom unavailable: {}", err);
72-
Err(Error::from_custom_error(NO_RNG_METHOD))
72+
Err(Error::internal(STDWEB_NO_RNG))
7373
}
7474
}
7575

@@ -105,7 +105,7 @@ fn getrandom_fill(source: RngSource, dest: &mut [u8]) -> Result<(), Error> {
105105
if js! { return @{ result.as_ref() }.success } != true {
106106
let err: WebError = js! { return @{ result }.error }.try_into().unwrap();
107107
error!("getrandom failed: {}", err);
108-
return Err(Error::from_custom_error(METHOD_FAILED));
108+
return Err(Error::internal(STDWEB_RNG_FAILED));
109109
}
110110
}
111111
Ok(())

0 commit comments

Comments
 (0)