Skip to content
This repository was archived by the owner on Oct 19, 2025. It is now read-only.

Conversation

@thmsbernard
Copy link

@thmsbernard thmsbernard commented Dec 22, 2021

When working with this library, I got a 400 bad request and it took me a while to troubleshoot the issue. This could save some time by including the error message returned by the spotify api.
In my case the spotify api was returning:

    error: {
      status: 400,
      message: 'You can add a maximum of 100 tracks per request.'
    }

Without this change, all I got in the console was:

Error: Request failed with status code 400
    at Object.<anonymous> ({project}/node_modules/spotify-web-api-ts/src/helpers/spotifyAxios.ts:30:11)
    at Generator.throw (<anonymous>)
    at rejected ({project}node_modules/spotify-web-api-ts/cjs/helpers/spotifyAxios.js:6:65)

And now:

Error: Request failed with status code 400: You can add a maximum of 100 tracks per request.
    at Object.<anonymous> ({project}node_modules/spotify-web-api-ts/src/helpers/spotifyAxios.ts:30:11)
    at Generator.throw (<anonymous>)
    at rejected ({project}/node_modules/spotify-web-api-ts/cjs/helpers/spotifyAxios.js:6:65)

@schickling
Copy link

@adamgrieger are you open to merging and releasing this? (Also, are you looking for collaborators on this project?)

@finnmerlett
Copy link

In addition to this it would be great to have the details of the spotify response available on the error object. To that end, I can't understand why this package owner rethrows the axios error message returned as a new error, discarding all that useful axios info. Why wouldn't they just let the axios error thrown propagate?

} catch (error) {
const err = error as AxiosError;
throw new Error(err.message);
}

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants