mirror of
https://github.com/denoland/deno.git
synced 2025-08-04 02:48:24 +00:00
refactor: update deno_core for error refactor (#26867)
Closes #26171 --------- Co-authored-by: David Sherret <dsherret@gmail.com>
This commit is contained in:
parent
814da49dff
commit
ea30e188a8
214 changed files with 3787 additions and 4210 deletions
|
@ -24,37 +24,23 @@ pub mod uv;
|
|||
use core::ptr::NonNull;
|
||||
use std::cell::RefCell;
|
||||
use std::collections::HashMap;
|
||||
pub use std::ffi::CStr;
|
||||
pub use std::os::raw::c_char;
|
||||
pub use std::os::raw::c_void;
|
||||
use std::path::PathBuf;
|
||||
pub use std::ptr;
|
||||
use std::rc::Rc;
|
||||
use std::thread_local;
|
||||
|
||||
use deno_core::op2;
|
||||
use deno_core::parking_lot::RwLock;
|
||||
use deno_core::url::Url;
|
||||
use deno_core::ExternalOpsTracker;
|
||||
use deno_core::OpState;
|
||||
use deno_core::V8CrossThreadTaskSpawner;
|
||||
|
||||
#[derive(Debug, thiserror::Error)]
|
||||
pub enum NApiError {
|
||||
#[error("Invalid path")]
|
||||
InvalidPath,
|
||||
#[error(transparent)]
|
||||
LibLoading(#[from] libloading::Error),
|
||||
#[error("Unable to find register Node-API module at {}", .0.display())]
|
||||
ModuleNotFound(PathBuf),
|
||||
#[error(transparent)]
|
||||
Permission(#[from] PermissionCheckError),
|
||||
}
|
||||
|
||||
pub use std::ffi::CStr;
|
||||
pub use std::os::raw::c_char;
|
||||
pub use std::os::raw::c_void;
|
||||
pub use std::ptr;
|
||||
|
||||
// Expose common stuff for ease of use.
|
||||
// `use deno_napi::*`
|
||||
pub use deno_core::v8;
|
||||
use deno_core::ExternalOpsTracker;
|
||||
use deno_core::OpState;
|
||||
use deno_core::V8CrossThreadTaskSpawner;
|
||||
use deno_permissions::PermissionCheckError;
|
||||
#[cfg(unix)]
|
||||
use libloading::os::unix::*;
|
||||
|
@ -65,6 +51,22 @@ pub use value::napi_value;
|
|||
pub mod function;
|
||||
mod value;
|
||||
|
||||
#[derive(Debug, thiserror::Error, deno_error::JsError)]
|
||||
pub enum NApiError {
|
||||
#[class(type)]
|
||||
#[error("Invalid path")]
|
||||
InvalidPath,
|
||||
#[class(type)]
|
||||
#[error(transparent)]
|
||||
LibLoading(#[from] libloading::Error),
|
||||
#[class(type)]
|
||||
#[error("Unable to find register Node-API module at {}", .0.display())]
|
||||
ModuleNotFound(PathBuf),
|
||||
#[class(inherit)]
|
||||
#[error(transparent)]
|
||||
Permission(#[from] PermissionCheckError),
|
||||
}
|
||||
|
||||
pub type napi_status = i32;
|
||||
pub type napi_env = *mut c_void;
|
||||
pub type napi_callback_info = *mut c_void;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue