spotify-api / spotify-api.js

A complete wrapper for spotify web api for deno, node.js and the browser.
https://spotify-api.js.org
MIT License
211 stars 19 forks source link

Properly reject the promise in client initialisation #167

Closed Arakmar closed 1 year ago

Arakmar commented 2 years ago

Changes

In case of an authentication error or an API outage during client initialisation, it's not possible to catch the error.

Status

adb-sh commented 1 year ago

looks good. this should fix https://github.com/spotify-api/spotify-api.js/discussions/14#discussioncomment-3826977

scientific-dev commented 1 year ago

The changes have been update in v9.2.5. If you encounter any bugs, open a new issue to resolve it.

Thanks for your support 👍 !

adb-sh commented 1 year ago

hey :D this could actually happen, because Client.fetch could throw a SpotifyAPIError exception, which is not caught.

On 2022-11-11 12:55, TheSudarsanDev wrote:

@Arakmar [1], By the way, i don't think, there are any possible ways to get any error at client._init as it is protected by try and catch in client.fetch itself. Have you ever encountered an error despite the try and catch?

-- Reply to this email directly, view it on GitHub [2], or unsubscribe [3]. You are receiving this because you commented.Message ID: @.***>

Links:

[1] https://github.com/Arakmar [2] https://github.com/spotify-api/spotify-api.js/pull/167#issuecomment-1311666825 [3] https://github.com/notifications/unsubscribe-auth/AJCZQF7NCKXLOQBNOTVT25DWHY63VANCNFSM56PQ66GQ

scientific-dev commented 1 year ago

Just now, noticed it. Still, thanks for your response!