mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-08-19 00:02:03 +00:00
21 lines
617 B
TypeScript
21 lines
617 B
TypeScript
import type { ApiRequestOptions } from './ApiRequestOptions.ts';
|
|
import type { ApiResult } from './ApiResult.ts';
|
|
|
|
export class ApiError extends Error {
|
|
public readonly url: string;
|
|
public readonly status: number;
|
|
public readonly statusText: string;
|
|
public readonly body: unknown;
|
|
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;
|
|
}
|
|
} |