UNPKG

@master-chief/alpaca-ts

Version:

A TypeScript Node.js library for the https://alpaca.markets REST API and WebSocket streams.

26 lines (22 loc) 651 B
import type { ApiRequestOptions } from "./ApiRequestOptions.js"; import type { ApiResult } from "./ApiResult.js"; export class ApiError extends Error { public readonly url: string; public readonly status: number; public readonly statusText: string; public readonly body: any; public readonly request: ApiRequestOptions; constructor( request: ApiRequestOptions, response: ApiResult, message: string ) { super(message); this.name = "ApiError"; this.url = response.url; this.status = response.status; this.statusText = response.statusText; this.body = response.body; this.request = request; } }