mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-15 09:06:19 +08:00
feat: improve native
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
use affine_common::doc_loader::Doc;
|
||||
use affine_common::{doc_loader::Doc, napi_utils::map_napi_err};
|
||||
use napi::{
|
||||
Env, Result, Task,
|
||||
anyhow::anyhow,
|
||||
Env, Result, Status, Task,
|
||||
bindgen_prelude::{AsyncTask, Buffer},
|
||||
};
|
||||
|
||||
@@ -54,7 +53,7 @@ impl Task for AsyncParseDocResponse {
|
||||
type JsValue = ParsedDoc;
|
||||
|
||||
fn compute(&mut self) -> Result<Self::Output> {
|
||||
let doc = Doc::new(&self.file_path, &self.doc).map_err(|e| anyhow!(e))?;
|
||||
let doc = map_napi_err(Doc::new(&self.file_path, &self.doc), Status::GenericFailure)?;
|
||||
Ok(Document { inner: doc })
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user