AurelioDeRosa / web-reader

A screen reader for everyone, everywhere
Other
30 stars 2 forks source link

downloadTranslation() does not return a rejected Promise if the translation file is not found #41

Closed AurelioDeRosa closed 8 years ago

AurelioDeRosa commented 8 years ago

The fetch() API does not return a rejected promise when the server returns a status code different from 200. For example, a code status of 404 does not return a rejected promise.

Quoting the relevant MDN page:

A fetch() promise will reject with a TypeError when a network error is encountered, although this usually means permission issues or similar — a 404 does not constitute a network error, for example.

The downloadTranslation() function does not take into account this behavior.