diff --git a/src/api/HTTPError.ts b/src/api/HTTPError.ts index 4be34b343..b3e586315 100644 --- a/src/api/HTTPError.ts +++ b/src/api/HTTPError.ts @@ -1,10 +1,12 @@ export class HTTPError extends Error { response: Response; + request: Request; - constructor(response: Response) { + constructor(response: Response, request: Request) { super(response.statusText); this.response = response; + this.request = request; } } \ No newline at end of file diff --git a/src/api/MastodonClient.ts b/src/api/MastodonClient.ts index 22eb35457..0f74abe17 100644 --- a/src/api/MastodonClient.ts +++ b/src/api/MastodonClient.ts @@ -84,7 +84,7 @@ export class MastodonClient { const response = await this.fetch(request); if (!response.ok) { - throw new HTTPError(response); + throw new HTTPError(response, request); } return response;