From 11f9f841596c645f4bb55599c451614ee20c66d2 Mon Sep 17 00:00:00 2001 From: Charlotte <61674780+lotte25@users.noreply.github.com> Date: Mon, 10 Feb 2025 05:10:27 -0300 Subject: [PATCH 1/5] fetchWithInstance: Actually use the given instance --- src/http/HTTP.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/http/HTTP.ts b/src/http/HTTP.ts index e61dd65..8249344 100644 --- a/src/http/HTTP.ts +++ b/src/http/HTTP.ts @@ -43,7 +43,7 @@ class HTTP { }; try { - const response = await this.axios(config); + const response = await instance(config); return response.data; } catch (e) { From a6859edf79ad8578aea5debdced768a1f89cab90 Mon Sep 17 00:00:00 2001 From: Charlotte <61674780+lotte25@users.noreply.github.com> Date: Mon, 10 Feb 2025 05:11:58 -0300 Subject: [PATCH 2/5] FortniteAPIError: Remove method property as it's never present --- src/exceptions/FortniteAPIError.ts | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/exceptions/FortniteAPIError.ts b/src/exceptions/FortniteAPIError.ts index bf5849a..2478194 100644 --- a/src/exceptions/FortniteAPIError.ts +++ b/src/exceptions/FortniteAPIError.ts @@ -5,11 +5,6 @@ import { FortniteAPIErrorData } from '../http/httpStructs'; * Represets a Fortnite-API HTTP error */ class FortniteAPIError extends Error { - /** - * The HTTP method - */ - public method: string; - /** * The URL of the requested API endpoint */ @@ -35,7 +30,6 @@ class FortniteAPIError extends Error { this.name = 'FortniteAPIError'; this.message = error.error; - this.method = request.method!.toUpperCase(); this.url = request.url!; this.httpStatus = status; this.requestParams = request.params; From 9ba5841d010fc13a0f6c12b9513d35b0a5eeeafe Mon Sep 17 00:00:00 2001 From: Charlotte <61674780+lotte25@users.noreply.github.com> Date: Tue, 1 Jul 2025 01:36:54 -0400 Subject: [PATCH 3/5] use request config from error if available in exception --- src/http/HTTP.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/http/HTTP.ts b/src/http/HTTP.ts index 8249344..b30bcc7 100644 --- a/src/http/HTTP.ts +++ b/src/http/HTTP.ts @@ -56,7 +56,7 @@ class HTTP { } } - throw new FortniteAPIError(e.response.data, config, e.response.status); + throw new FortniteAPIError(e.response.data, e.config ?? config, e.response.status); } throw e; From d33788837d0f784f185dd54d8955d4e0cbcf435a Mon Sep 17 00:00:00 2001 From: Charlotte <61674780+lotte25@users.noreply.github.com> Date: Tue, 1 Jul 2025 01:40:31 -0400 Subject: [PATCH 4/5] add HTTP method fallback to exception --- src/exceptions/FortniteAPIError.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/exceptions/FortniteAPIError.ts b/src/exceptions/FortniteAPIError.ts index 2478194..c1e0297 100644 --- a/src/exceptions/FortniteAPIError.ts +++ b/src/exceptions/FortniteAPIError.ts @@ -30,6 +30,7 @@ class FortniteAPIError extends Error { this.name = 'FortniteAPIError'; this.message = error.error; + this.method = request.method?.toUpperCase() ?? 'GET' this.url = request.url!; this.httpStatus = status; this.requestParams = request.params; From b7b11f0dac1b693f1ce262375ae55aac161cf8bd Mon Sep 17 00:00:00 2001 From: Charlotte <61674780+lotte25@users.noreply.github.com> Date: Thu, 3 Jul 2025 04:52:09 -0400 Subject: [PATCH 5/5] readd method property to FortniteAPIError --- src/exceptions/FortniteAPIError.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/exceptions/FortniteAPIError.ts b/src/exceptions/FortniteAPIError.ts index c1e0297..e11f2cb 100644 --- a/src/exceptions/FortniteAPIError.ts +++ b/src/exceptions/FortniteAPIError.ts @@ -5,6 +5,11 @@ import { FortniteAPIErrorData } from '../http/httpStructs'; * Represets a Fortnite-API HTTP error */ class FortniteAPIError extends Error { + /** + * The HTTP method + */ + public method: string; + /** * The URL of the requested API endpoint */