Improve error message of fetch when xhr.onerror occurs (#3003)

* Ensure fetch-tests fail (instead of timeout) on failure

* Standardize failure handling in fetch-tests

* Improve flawed failure condition of test_fetch_json

Previously, the assertion was always true

* Implement better error message for for xhr.onerror within fetch
This commit is contained in:
Adam Voss
2016-11-07 03:04:39 -06:00
committed by Vladimir Enchev
parent 329817a2ba
commit 06c04c41fb
2 changed files with 34 additions and 87 deletions

View File

@ -310,8 +310,8 @@
resolve(new Response(xhr.responseText, options))
}
xhr.onerror = function () {
reject(new TypeError('Network request failed'))
xhr.onerror = function (error) {
reject(new TypeError(['Network request failed:', error.message].join(' ')))
}
xhr.open(request.method, request.url, true)