← back to Govarbitrage

apps/mobile/lib/api-error.ts

15 lines

/**
 * ApiError lives in its own module so both the API client (api.ts) and the
 * payload validator (validate.ts) can throw/import it without a circular
 * import between them.
 */
export class ApiError extends Error {
  constructor(
    public readonly status: number,
    message: string
  ) {
    super(message);
    this.name = "ApiError";
  }
}