mirror of
https://github.com/lancedb/lancedb.git
synced 2026-12-03 07:45:17 +00:00
## Summary The Node SDK now throws typed `LanceError` subclasses instead of one generic `Error` with an indented `Caused by` string. Fixes #222 ## Before / after ```ts try { await db.openTable(\"missing\"); } catch (error) { if (error instanceof TableNotFoundError) { error.code; // \"TableNotFound\" error.tableName; // \"missing\" error.message; // \"Table 'missing' was not found\" error.cause; // underlying dataset error } } ``` ## Changes - `nodejs/src/error.rs` — map each `lancedb::Error` variant to a one-line header + `error.cause` - `nodejs/src/query.rs`, `nodejs/src/merge.rs` — pass errors through instead of stringifying - `nodejs/lancedb/errors.ts`, `errors_install.ts` — real subclasses when the package loads - Tests + generated API docs under `docs/src/js/` ## Test plan - [x] Native debug build, `tsc`, Biome, `cargo clippy -p lancedb-nodejs` - [x] Jest: new error tests, remote retry, connection/query/table (594 passed) ## Notes Node-API cannot construct a custom `Error` subclass from an async Rust rejection, so translation happens in JS when `@lancedb/lancedb` loads. Calling the raw native addon without that entrypoint still shows the header line. --------- Signed-off-by: ZYZ666-RGB <1991039819@qq.com> Signed-off-by: yuzhou <1991039819@qq.com> Co-authored-by: Xuanwo <github@xuanwo.io>
486 B
486 B
@lancedb/lancedb • Docs
@lancedb/lancedb / isAlreadyExistsError
Function: isAlreadyExistsError()
function isAlreadyExistsError(error): error is TableAlreadyExistsError | DatabaseAlreadyExistsError | ColumnAlreadyExistsError
True for table, database, and column create conflicts.
Parameters
- error:
unknown
Returns
error is TableAlreadyExistsError | DatabaseAlreadyExistsError | ColumnAlreadyExistsError