Elffuss BraidHub

kikocis/lancedb public

main · 367 BRawPermalink
1pub type Result<T> = napi::Result<T>;
2
3pub trait NapiErrorExt<T> {
4 /// Convert to a napi error using from_reason(err.to_string())
5 fn default_error(self) -> Result<T>;
6}
7
8impl<T> NapiErrorExt<T> for std::result::Result<T, lancedb::Error> {
9 fn default_error(self) -> Result<T> {
10 self.map_err(|err| napi::Error::from_reason(err.to_string()))
11 }
12}