mirror of
https://github.com/denoland/deno.git
synced 2025-01-21 04:52:26 -05:00
use future
This commit is contained in:
parent
9404dfc8cb
commit
eafec84357
1 changed files with 12 additions and 11 deletions
|
@ -1,5 +1,6 @@
|
||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
use std::cell::RefCell;
|
use std::cell::RefCell;
|
||||||
|
use std::future::Future;
|
||||||
use std::num::NonZeroU64;
|
use std::num::NonZeroU64;
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
|
|
||||||
|
@ -606,28 +607,28 @@ impl GPUDevice {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[async_method]
|
#[async_method]
|
||||||
async fn pop_error_scope<'a>(
|
fn pop_error_scope<'a>(
|
||||||
&self,
|
&self,
|
||||||
//scope: &mut v8::HandleScope<'a>,
|
scope: &mut v8::HandleScope<'a>,
|
||||||
) -> Result<v8::Local<'a, v8::Value>, JsErrorBox> {
|
) -> impl Future<Output = Result<v8::Local<'a, v8::Value>, JsErrorBox>> {
|
||||||
/* if self.error_handler.is_lost.get().is_some() {
|
if self.error_handler.is_lost.get().is_some() {
|
||||||
return Ok(v8::null(scope).into());
|
return std::future::ready(Ok(v8::null(scope).into()));
|
||||||
}
|
}
|
||||||
|
|
||||||
let Some((_, errors)) = self.error_handler.scopes.borrow_mut().pop() else {
|
let Some((_, errors)) = self.error_handler.scopes.lock().unwrap().pop() else {
|
||||||
return Err(JsErrorBox::new(
|
return std::future::ready(Err(JsErrorBox::new(
|
||||||
"DOMExceptionOperationError",
|
"DOMExceptionOperationError",
|
||||||
"There are no error scopes on the error scope stack",
|
"There are no error scopes on the error scope stack",
|
||||||
));
|
)));
|
||||||
};
|
};
|
||||||
|
|
||||||
if let Some(err) = errors.into_iter().next() {
|
let val = if let Some(err) = errors.into_iter().next() {
|
||||||
Ok(deno_core::error::to_v8_error(scope, &err))
|
Ok(deno_core::error::to_v8_error(scope, &err))
|
||||||
} else {
|
} else {
|
||||||
Ok(v8::null(scope).into())
|
Ok(v8::null(scope).into())
|
||||||
}*/
|
};
|
||||||
|
|
||||||
todo!()
|
std::future::ready(val)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue