message: create api clients
diff: @@ -16,6 +16,7 @@ import {
  responsivelyThrottleHttpClient,
  } from './http-client';
  import { API_KEY } from './bungie-api-utils';
  +import { HttpClient, HttpClientConfig } from 'bungie-api-ts/http';
  export interface DimError extends Error {
  code?: PlatformErrorCodes | string;
  @@ -40,7 +41,8 @@ const notifyTimeout = _.throttle(
  { leading: true, trailing: false }
  );
  -export const authenticatedHttpClient = responsivelyThrottleHttpClient(
  +export const authenticatedHttpClient = dimErrorHandledHttpClient(
  + responsivelyThrottleHttpClient(
  createHttpClient(
  createFetchWithNonStoppingTimeout(
  rateLimitedFetch(fetchWithBungieOAuth),
  @@ -50,10 +52,17 @@ export const authenticatedHttpClient = responsivelyThrottleHttpClient(
  API_KEY,
  true
  )
  + )
  );
  -export const unauthenticatedHttpClient = responsivelyThrottleHttpClient(
  - createHttpClient(createFetchWithNonStoppingTimeout(fetch, TIMEOUT, notifyTimeout), API_KEY, false)
  +export const unauthenticatedHttpClient = dimErrorHandledHttpClient(
  + responsivelyThrottleHttpClient(
  + createHttpClient(
  + createFetchWithNonStoppingTimeout(fetch, TIMEOUT, notifyTimeout),
  + API_KEY,
  + false
  + )
  + )
  );
  /** Generate an error with a bit more info */
  @@ -63,6 +72,19 @@ export function dimError(message: string, errorCode: PlatformErrorCodes): DimErr
  return error;
  }
  +/**
  + * wrap HttpClient in handling specific to DIM, using i18n strings, bounce to login, etc
  + */
  +export function dimErrorHandledHttpClient(httpClient: HttpClient): HttpClient {
  + return async (config: HttpClientConfig) => {
  + try {
  + return await httpClient(config);
  + } catch (e) {
  + handleErrors(e);
  + }
  + };
  +}
  +
  export async function handleErrors(error: Error) {
  if (error instanceof DOMException && error.name === 'AbortError') {
  throw new Error(
  