mirror of
https://github.com/denoland/deno.git
synced 2025-08-04 02:48:24 +00:00
refactor: use the 'anyhow' crate instead of 'ErrBox' (#7476)
This commit is contained in:
parent
3da20d19a1
commit
f5b40c918c
63 changed files with 898 additions and 861 deletions
|
@ -31,10 +31,10 @@ pub mod websocket;
|
|||
pub mod worker_host;
|
||||
|
||||
use crate::metrics::metrics_op;
|
||||
use deno_core::error::AnyError;
|
||||
use deno_core::json_op_async;
|
||||
use deno_core::json_op_sync;
|
||||
use deno_core::BufVec;
|
||||
use deno_core::ErrBox;
|
||||
use deno_core::JsRuntime;
|
||||
use deno_core::OpState;
|
||||
use deno_core::ZeroCopyBuf;
|
||||
|
@ -46,14 +46,14 @@ use std::rc::Rc;
|
|||
pub fn reg_json_async<F, R>(rt: &mut JsRuntime, name: &'static str, op_fn: F)
|
||||
where
|
||||
F: Fn(Rc<RefCell<OpState>>, Value, BufVec) -> R + 'static,
|
||||
R: Future<Output = Result<Value, ErrBox>> + 'static,
|
||||
R: Future<Output = Result<Value, AnyError>> + 'static,
|
||||
{
|
||||
rt.register_op(name, metrics_op(json_op_async(op_fn)));
|
||||
}
|
||||
|
||||
pub fn reg_json_sync<F>(rt: &mut JsRuntime, name: &'static str, op_fn: F)
|
||||
where
|
||||
F: Fn(&mut OpState, Value, &mut [ZeroCopyBuf]) -> Result<Value, ErrBox>
|
||||
F: Fn(&mut OpState, Value, &mut [ZeroCopyBuf]) -> Result<Value, AnyError>
|
||||
+ 'static,
|
||||
{
|
||||
rt.register_op(name, metrics_op(json_op_sync(op_fn)));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue