afcapel / stimulus-autocomplete

Stimulus autocomplete component
MIT License
482 stars 63 forks source link

Question: Handle a 429 Response? #136

Open miketheman opened 1 year ago

miketheman commented 1 year ago

One of the implementations we're doing with this cool library is enabling username search. The server-side API being called has rate limits applied, and may respond with a 429 Too Many Requests error, and today the library barfs:

Uncaught (in promise) Error: Server responded with status 429
    at extended.doFetch (autocomplete.js:224:1)
    at async extended.fetchResults (autocomplete.js:200:1)

(Thanks for adding that in https://github.com/afcapel/stimulus-autocomplete/pull/115 ! )

The question is: