mirror of
https://github.com/lancedb/lancedb.git
synced 2025-12-27 23:12:58 +00:00
This also refactors the rust lancedb index builder API (and, correspondingly, the nodejs API)
13 lines
367 B
Rust
13 lines
367 B
Rust
pub type Result<T> = napi::Result<T>;
|
|
|
|
pub trait NapiErrorExt<T> {
|
|
/// Convert to a napi error using from_reason(err.to_string())
|
|
fn default_error(self) -> Result<T>;
|
|
}
|
|
|
|
impl<T> NapiErrorExt<T> for std::result::Result<T, lancedb::Error> {
|
|
fn default_error(self) -> Result<T> {
|
|
self.map_err(|err| napi::Error::from_reason(err.to_string()))
|
|
}
|
|
}
|