• Robert Knight's avatar
    Add `fetchJSON` utility · a8fa207e
    Robert Knight authored
    Add a utility function that wraps `fetch` to throw more consistent and
    useful exceptions if the request fails, making downstream handling
    easier.
    
    - Error messages thrown by failed `fetch` requests are unhelpful for
      downstream consumers. There is no specific Error subclass and the
      error messages vary depending on cause and browser.
    
    - Parsing the JSON response from a request with `Response.json()` can
      fail if the request has a success status and the error messages also
      vary by browser.
    
    The `fetchJSON` utility throws a `FetchError` error if either of the
    above failures occurs or if the response code indicates a failure.
    a8fa207e
Name
Last commit
Last update
..
collections-test.js Loading commit data...
copy-to-clipboard-test.js Loading commit data...
disable-opener-for-external-links-test.js Loading commit data...
dom-test.js Loading commit data...
fetch-test.js Loading commit data...
immutable-test.js Loading commit data...
memoize-test.js Loading commit data...
oauth-client-test.js Loading commit data...
observe-element-size-test.js Loading commit data...
pagination-test.js Loading commit data...
postmessage-json-rpc-test.js Loading commit data...
random-test.js Loading commit data...
retry-test.js Loading commit data...
search-filter-test.js Loading commit data...
sentry-test.js Loading commit data...
time-test.js Loading commit data...
unicode-test.js Loading commit data...
url-test.js Loading commit data...
watch-test.js Loading commit data...