Arrow Flight Client Node.js

Read error details

Request the missing demo/missing table from the local Flight server. Use FlightCallOptions.onTrailer to capture the call's trailing metadata. PyArrow sends the bytes from FlightError.extra_info in grpc-status-details-bin. Arrow transport

error-details.ts
import { FlightClient, pathDescriptor } from 'arrow-flight-client';
import type { FlightResponseMetadata } from 'arrow-flight-client';

async function main() {
  const client = new FlightClient('127.0.0.1:8815');
  let trailer: FlightResponseMetadata | undefined;

  try {
    await client.getFlightInfo(pathDescriptor('demo', 'missing'), {
      onTrailer: (metadata) => {
        trailer = metadata;
      }
    });
  }
  catch (error) {
    const extraInfo = trailer?.['grpc-status-details-bin']?.[0];

    if (extraInfo instanceof Uint8Array) {
      console.error('Flight extra_info:', Buffer.from(extraInfo).toString('utf8'));
    }

    throw error;
  }
  finally {
    await client.close();
  }
}

await main();

onTrailer receives arrays of strings or bytes when the RPC completes. Interpret the bytes according to the server's format. The example decodes UTF-8 text and propagates the error with its code and details. Calls that fail before a server response may have no trailers.