Repository navigation
Failure handling for the remaining api.js and element.js requests
v0.0.9 only covered the four JSON functions. Every other network call in the library had the same problem.
postFile,postFileWithHeader,postFileJSON: a network failure was only logged, andJSON.parsethrew on a non-JSON reply. Either way the callback never fired. They now call back withnull, or{status: 0, data: null}forpostFileJSON.getFileBytesWithHeader: on a 200 reply it readresponse.arrayBuffer()and then discarded it, so the function never delivered file bytes to anyone. It now passes theArrayBufferto the callback.getFileWithHeaderandgetFileBytesWithHeader: a non-JSON error body previously stopped the callback from firing; network failures now call back with{status: 0}.insertHTML: the error message blamed a missing element for every failure, including network errors. The element is now checked before the request.- Added the 15 second timeout to every request in
api.js, and torenderHTML/replaceTaginelement.js.