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.
Example
Section titled “Example”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 }}Extends
Section titled “Extends”Error
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new SparkConnectError(message, options): SparkConnectError;Defined in: errors.ts:108
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
message | string |
options | { cause?: unknown; code: number; errorClass?: string; errorTypeHierarchy?: readonly string[]; messageParameters?: Record<string, string>; serverStackTrace?: readonly string[]; sqlState?: string; } |
options.cause? | unknown |
options.code | number |
options.errorClass? | string |
options.errorTypeHierarchy? | readonly string[] |
options.messageParameters? | Record<string, string> |
options.serverStackTrace? | readonly string[] |
options.sqlState? | string |
Returns
Section titled “Returns”SparkConnectError
Overrides
Section titled “Overrides”Error.constructorProperties
Section titled “Properties”readonly code: number;Defined in: errors.ts:82
gRPC status code (0 = OK, 14 = UNAVAILABLE, etc.)
errorClass?
Section titled “errorClass?”readonly optional errorClass?: string;Defined in: errors.ts:85
Spark error class if available (e.g. “TABLE_OR_VIEW_NOT_FOUND”)
errorTypeHierarchy?
Section titled “errorTypeHierarchy?”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.
messageParameters?
Section titled “messageParameters?”readonly optional messageParameters?: Record<string, string>;Defined in: errors.ts:91
Server-supplied error message parameters keyed by name.
serverStackTrace?
Section titled “serverStackTrace?”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.
sqlState?
Section titled “sqlState?”readonly optional sqlState?: string;Defined in: errors.ts:88
SQL state code if available (e.g. “42P01”)