Skip to content

SparkConnectError

Defined in: errors.ts:80

An error returned by the Spark Connect server or raised at the gRPC transport layer.

Carries the gRPC code, and when available the Spark errorClass (for example "TABLE_OR_VIEW_NOT_FOUND") and SQL state code.

try {
await spark.sql("SELECT * FROM missing").collect();
} catch (err) {
if (err instanceof SparkConnectError && err.errorClass === "TABLE_OR_VIEW_NOT_FOUND") {
// handle known error class
}
}
  • Error
new SparkConnectError(message, options): SparkConnectError;

Defined in: errors.ts:108

ParameterType
messagestring
options{ cause?: unknown; code: number; errorClass?: string; errorTypeHierarchy?: readonly string[]; messageParameters?: Record<string, string>; serverStackTrace?: readonly string[]; sqlState?: string; }
options.cause?unknown
options.codenumber
options.errorClass?string
options.errorTypeHierarchy?readonly string[]
options.messageParameters?Record<string, string>
options.serverStackTrace?readonly string[]
options.sqlState?string

SparkConnectError

Error.constructor
readonly code: number;

Defined in: errors.ts:82

gRPC status code (0 = OK, 14 = UNAVAILABLE, etc.)


readonly optional errorClass?: string;

Defined in: errors.ts:85

Spark error class if available (e.g. “TABLE_OR_VIEW_NOT_FOUND”)


readonly optional errorTypeHierarchy?: readonly string[];

Defined in: errors.ts:98

Fully qualified class names of the server-side exception and its parent classes, root-most first. Populated when the server returns rich error details via FetchErrorDetails.


readonly optional messageParameters?: Record<string, string>;

Defined in: errors.ts:91

Server-supplied error message parameters keyed by name.


readonly optional serverStackTrace?: readonly string[];

Defined in: errors.ts:106

Server-side stack trace as JVM frame strings, populated only when the server has spark.sql.connect.serverStacktrace.enabled=true. Production deployments usually leave this disabled, so the field is empty in most cases.


readonly optional sqlState?: string;

Defined in: errors.ts:88

SQL state code if available (e.g. “42P01”)