afcapel / stimulus-autocomplete

Stimulus autocomplete component
MIT License
482 stars 63 forks source link

error event doesn't fire on 400+ response #113

Closed benjamin-aubry closed 2 years ago

benjamin-aubry commented 2 years ago

Hello and thank you for your work,

Can you tell me when the "error" event is supposed to fire ?

For me, a 400 or 500 http response doesn't fire the error event. Maybe it is due to the use of fetch...

Thx

afcapel commented 2 years ago

Yes, it follows the fetch convention where it only rejects the promise if there's a network error, but not if the server responds with an error. Agree this is not ideal, we can change it to raise on 400-500.