Skip to content

Conversation

@lotte25
Copy link
Contributor

@lotte25 lotte25 commented Feb 11, 2025

The reason for removing method property from FortniteAPIError is that it's never present, and the method is actually static so no point on specifying it on an error. Also, when using CommonJS and requesting a non-existent user's brStats, it will fail but because the ! is not present on the transpiled version of FortniteAPIError, giving an error when using toUpperCase():

[04:10:28.502] ERROR (12272): Error in command "fortnite"
    err: {
      "type": "TypeError",
      "message": "Cannot read properties of undefined (reading 'toUpperCase')",
      "stack":
          TypeError: Cannot read properties of undefined (reading 'toUpperCase')
              at new FortniteAPIError (D:\Coding\Node.js\neru-wa\node_modules\fnapicom\dist\src\exceptions\FortniteAPIError.js:16:38)
              at HTTP.fetchWithInstance (D:\Coding\Node.js\neru-wa\node_modules\fnapicom\dist\src\http\HTTP.js:53:23)
              ...

And i noticed the rate-limited axios instance was never used in fetchWithInstance, so i changed that too.

If there's anything wrong tell me.

Copy link
Collaborator

@ThisNils ThisNils left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey, good catch on the instance thing, no idea how I missed that.

Let's keep the method attribute and change how the error is being thrown so it's not undefined:

- throw new FortniteAPIError(e.response.data, config, e.response.status);
+ throw new FortniteAPIError(e.response.data, e.config ?? config, e.response.status);

@ThisNils
Copy link
Collaborator

ThisNils commented May 8, 2025

Sorry for the late reply btw. I didn't get any notifications since I don't technically own this repo. You can join the fortnite-api Discord server and ping me there next time.

@lotte25
Copy link
Contributor Author

lotte25 commented Jul 1, 2025

Sorry for the late reply btw. I didn't get any notifications since I don't technically own this repo. You can join the fortnite-api Discord server and ping me there next time.

I'm so sorry man. I totally forgot about this. I made the changes you suggested, is that good enough?
Again, sorry for the super late response.

@ThisNils
Copy link
Collaborator

ThisNils commented Jul 1, 2025

No worries. The changes look good, just one thing: could you also readd the following part of the FortniteAPIError:

/**
 * The HTTP method
 */
public method: string;

Thanks for your contribution!

@lotte25
Copy link
Contributor Author

lotte25 commented Jul 3, 2025

No worries. The changes look good, just one thing: could you also readd the following part of the FortniteAPIError:

/**
 * The HTTP method
 */
public method: string;

Thanks for your contribution!

There it is. Thank you u u

@ThisNils ThisNils merged commit 604781f into Fortnite-API:master Jul 3, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants