• 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
..
test Loading commit data...
collections.js Loading commit data...
copy-to-clipboard.js Loading commit data...
disable-opener-for-external-links.js Loading commit data...
dom.js Loading commit data...
fetch.js Loading commit data...
immutable.js Loading commit data...
memoize.js Loading commit data...
oauth-client.js Loading commit data...
observe-element-size.js Loading commit data...
pagination.js Loading commit data...
postmessage-json-rpc.js Loading commit data...
random.js Loading commit data...
retry.js Loading commit data...
search-filter.js Loading commit data...
sentry.js Loading commit data...
time.js Loading commit data...
typing.js Loading commit data...
unicode.js Loading commit data...
url.js Loading commit data...
watch.js Loading commit data...