Athena

Errors and retries

AthenaResult shape, errorDetails, AthenaGatewayError, and reliability helpers in @xylex-group/athena.

Query and mutation results

Every awaitable builder resolves to an AthenaResult:

const { data, error, errorDetails, status, count, raw } =
  await athena.from("users").select();

if (error) {
  console.error(`[${status}] ${error}`);
  console.error(errorDetails?.code, errorDetails?.endpoint, errorDetails?.requestId);
  return;
}

React hook

useAthenaGateway sets error from failed fetch calls. insertGateway, updateGateway, deleteGateway, and rpcGateway throw on failure — wrap in try/catch. Use AthenaGatewayError and isAthenaGatewayError for typed handling.

Reliability helpers

The package exports helpers such as isOk, unwrap, unwrapRows, unwrapOne, requireSuccess, requireAffected, normalizeAthenaError, coerceInt, assertInt, and withRetry. Full signatures live in the API reference.