Rename RuntimeError::custom to RuntimeError::user

This commit is contained in:
Amanieu d'Antras
2021-12-20 17:16:31 +01:00
parent 4924a7c22a
commit 3a67783fd1
2 changed files with 3 additions and 3 deletions

View File

@@ -65,7 +65,7 @@ impl RuntimeError {
/// Raises a custom user Error
#[deprecated(since = "2.1.1", note = "return a Result from host functions instead")]
pub fn raise(error: Box<dyn Error + Send + Sync>) -> ! {
let error = Self::custom(error);
let error = Self::user(error);
let js_error: JsValue = error.into();
wasm_bindgen::throw_val(js_error)
}
@@ -74,7 +74,7 @@ impl RuntimeError {
///
/// This error object can be passed through Wasm frames and later retrieved
/// using the `downcast` method.
pub fn custom(error: Box<dyn Error + Send + Sync>) -> Self {
pub fn user(error: Box<dyn Error + Send + Sync>) -> Self {
match error.downcast::<Self>() {
// The error is already a RuntimeError, we return it directly
Ok(runtime_error) => *runtime_error,