ExArrow.FlightSQL.Error exception (ex_arrow v0.6.0)

View Source

Structured error type for Flight SQL operations.

All client and transport failures are returned as {:error, %ExArrow.FlightSQL.Error{}} from non-bang functions, or raised from bang functions (e.g. query!/2).

Error codes

CodeSource
:transport_errorTCP/TLS channel failure before any RPC completes
:server_errorgRPC INTERNAL status from the server
:unimplementedgRPC UNIMPLEMENTED — server does not support the operation
:unauthenticatedgRPC UNAUTHENTICATED — missing or rejected credentials
:permission_deniedgRPC PERMISSION_DENIED
:not_foundgRPC NOT_FOUND
:invalid_argumentgRPC INVALID_ARGUMENT — bad SQL syntax, wrong parameter types
:protocol_errorMalformed or unexpected Flight SQL response structure
:multi_endpointFlightInfo returned more than one endpoint; not supported in v0.5.0
:invalid_optionInvalid connect or query option at the Elixir layer
:conversion_errorArrow → Explorer or Arrow → Nx conversion failure

Examples

{:error, %ExArrow.FlightSQL.Error{code: :invalid_argument, message: "syntax error"}} =
  ExArrow.FlightSQL.Client.query(client, "SELECT FROM")

try do
  ExArrow.FlightSQL.Client.query!(client, "BAD SQL")
rescue
  e in ExArrow.FlightSQL.Error -> IO.inspect(e.code)
end

Summary

Types

code()

@type code() ::
  :transport_error
  | :server_error
  | :unimplemented
  | :unauthenticated
  | :permission_denied
  | :not_found
  | :invalid_argument
  | :protocol_error
  | :multi_endpoint
  | :invalid_option
  | :conversion_error

t()

@type t() :: %ExArrow.FlightSQL.Error{
  __exception__: term(),
  code: code(),
  details: term() | nil,
  grpc_status: integer() | nil,
  message: String.t()
}