Files
lancedb/docs/src/js/classes/CreateDirError.md
T
yuzhouandXuanwo b3ad97a28d feat(node): surface Rust errors as typed JavaScript errors (#4901)
## 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>
2026-12-01 11:28:22 +08:00

6.2 KiB

@lancedb/lancedb • Docs


@lancedb/lancedb / CreateDirError

Class: CreateDirError

Creating a dataset directory failed.

Extends

Constructors

new CreateDirError()

new CreateDirError(message, options?): CreateDirError

Parameters

Returns

CreateDirError

Inherited from

LanceError.constructor

Properties

cause?

optional cause: unknown;

Inherited from

LanceError.cause


code

readonly code: string;

Inherited from

LanceError.code


columnName?

readonly optional columnName: string;

Inherited from

LanceError.columnName


connectFailures?

readonly optional connectFailures: number;

Inherited from

LanceError.connectFailures


databaseName?

readonly optional databaseName: string;

Inherited from

LanceError.databaseName


errorCode?

readonly optional errorCode: string;

Inherited from

LanceError.errorCode


functionName?

readonly optional functionName: string;

Inherited from

LanceError.functionName


grpcCode?

readonly optional grpcCode: number;

Inherited from

LanceError.grpcCode


indexName?

readonly optional indexName: string;

Inherited from

LanceError.indexName


jobId?

readonly optional jobId: string;

Inherited from

LanceError.jobId


jobRequestId?

readonly optional jobRequestId: string;

Inherited from

LanceError.jobRequestId


maxConnectFailures?

readonly optional maxConnectFailures: number;

Inherited from

LanceError.maxConnectFailures


maxReadFailures?

readonly optional maxReadFailures: number;

Inherited from

LanceError.maxReadFailures


maxRequestFailures?

readonly optional maxRequestFailures: number;

Inherited from

LanceError.maxRequestFailures


message

message: string;

Inherited from

LanceError.message


name

name: string;

Inherited from

LanceError.name


namespacePath?

readonly optional namespacePath: string[];

Inherited from

LanceError.namespacePath


path?

readonly optional path: string;

Inherited from

LanceError.path


phase?

readonly optional phase: string;

Inherited from

LanceError.phase


readFailures?

readonly optional readFailures: number;

Inherited from

LanceError.readFailures


requestFailures?

readonly optional requestFailures: number;

Inherited from

LanceError.requestFailures


requestId?

readonly optional requestId: string;

Inherited from

LanceError.requestId


resourceKind?

readonly optional resourceKind: string;

Inherited from

LanceError.resourceKind


resourceName?

readonly optional resourceName: string;

Inherited from

LanceError.resourceName


retryable?

readonly optional retryable: boolean;

Inherited from

LanceError.retryable


sqlJobId?

readonly optional sqlJobId: string;

Inherited from

LanceError.sqlJobId


stack?

optional stack: string;

Inherited from

LanceError.stack


statusCode?

readonly optional statusCode: number;

Inherited from

LanceError.statusCode


tableName?

readonly optional tableName: string;

Inherited from

LanceError.tableName


code

readonly static code: "CreateDir" = "CreateDir";

Overrides

LanceError.code


prepareStackTrace()?

static optional prepareStackTrace: (err, stackTraces) => any;

Optional override for formatting stack traces

Parameters

  • err: Error

  • stackTraces: CallSite[]

Returns

any

See

https://v8.dev/docs/stack-trace-api#customizing-stack-traces

Inherited from

LanceError.prepareStackTrace


stackTraceLimit

static stackTraceLimit: number;

Inherited from

LanceError.stackTraceLimit

Methods

captureStackTrace()

static captureStackTrace(targetObject, constructorOpt?): void

Create .stack property on a target object

Parameters

  • targetObject: object

  • constructorOpt?: Function

Returns

void

Inherited from

LanceError.captureStackTrace