Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make sure useFetch rejects with an Error type. #114

Merged
merged 3 commits into from
Sep 19, 2019

Commits on Sep 17, 2019

  1. Make sure useFetch rejects with an Error type.

    Previously, a non-ok http response would reject with the response
    object. It's better for rejections to be of type Error so that the
    full stack trace information is available; plus, the TypeScript type
    definition assumes that the error object is always instanceof Error.
    
    Instead, failed responses reject with a FetchError, with the
    underlying Response object available as error.response.
    
    This is a backward-incompatible change: users who expected `error` to
    be of type Response now have to refer to `error.response` instead.
    artdent committed Sep 17, 2019
    Configuration menu
    Copy the full SHA
    0ca7c03 View commit details
    Browse the repository at this point in the history

Commits on Sep 19, 2019

  1. Configuration menu
    Copy the full SHA
    fcc67d2 View commit details
    Browse the repository at this point in the history
  2. Define FetchError as a class, not just an interface.

    This is necessary for TypeScript code to be permitted to use
    FetchError as a value at runtime, e.g. to perform an `instanceof
    FetchError` check.
    artdent committed Sep 19, 2019
    Configuration menu
    Copy the full SHA
    dba0bd7 View commit details
    Browse the repository at this point in the history