Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 725663f

Browse files
committedJul 18, 2024·
refactor and improve panic message
1 parent 971f873 commit 725663f

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed
 

‎crates/net/src/http/request.rs

+7-5
Original file line numberDiff line numberDiff line change
@@ -337,13 +337,15 @@ impl Request {
337337
let maybe_fetch =
338338
js_sys::Reflect::get(&global, &JsValue::from_str("fetch")).unwrap();
339339
if maybe_fetch.is_undefined() {
340-
panic!("no global fetch()")
340+
panic!("no supported fetch api")
341341
}
342-
let fetch = maybe_fetch.dyn_into::<js_sys::Function>().unwrap();
343-
let promise = fetch
342+
maybe_fetch
343+
.dyn_into::<js_sys::Function>()
344+
.unwrap()
344345
.call1(&global, &unsafe { JsValue::from_abi(request.return_abi()) })
345-
.map_err(js_to_error)?;
346-
promise.dyn_into::<js_sys::Promise>().unwrap()
346+
.map_err(js_to_error)?
347+
.dyn_into::<js_sys::Promise>()
348+
.unwrap()
347349
}
348350
};
349351

0 commit comments

Comments
 (0)
Please sign in to comment.