bluesky-social / atproto

Social networking technology created by Bluesky
Other
7.31k stars 517 forks source link

@atproto/api bluesky client - error 'TypeError: fetch failed' - get more details for industrialization #2786

Open boly38 opened 2 months ago

boly38 commented 2 months ago

Is your feature request related to a problem? Please describe.

I'm using Bluesky api client in NodeJs especially bsky.feed.searchPosts api and in some cases (ex. Internet unavailability) I've got as error details TypeError: fetch failed (this is the raw content of the error field)

Out-of-error, I'm unable to get more details than "it failed to fetch"...

Is it transient server unavailability, a rate limit, a transient network issue, a permanent one etc. And this is frustrating : ex. can I retry or is it useless ? how to explain ?

(client library code side) Out of known issue (handler), it seems that this is the default error message returned.

NB: at the opposite, a known issue like 400 invalid param is quite well reported as it internally produce BadQueryStringError with clear message, status, error short code 👍

  status: 400,
  error: 'InvalidRequest',
  success: false,`
  message: 'Error: limit can not be less than 1'

Describe the solution you'd like

As API client user, I would like a status (ex. http status like) which could drives my app to take the good business decision :

Describe alternatives you've considered

As alternative solution, I will retry the search X times when I've got the default error message TypeError: fetch failed. (But this is extra stuff/controls that Bluesky client could/should ideally handle on his own)

Additional context