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

Expose NSError #3315

Merged
merged 2 commits into from
Aug 25, 2021
Merged

Expose NSError #3315

merged 2 commits into from
Aug 25, 2021

Conversation

martinbonnin
Copy link
Contributor

@martinbonnin martinbonnin commented Aug 24, 2021

Expose the platform error in ApolloNetworkError:

    try {
      apolloClient.query(HeroNameQuery())
    } catch (e: ApolloNetworkException) {
      when((e.platformCause as? NSError)?.code) {
        NSURLErrorCannotFindHost -> handleCannotFindHost()
        NSURLErrorNetworkUnavailableReason -> handleNetworkUnavailable()
        else -> // fallback
      }
    }

Closes #3307

@martinbonnin martinbonnin merged commit 79a6a28 into dev-3.x Aug 25, 2021
@martinbonnin martinbonnin deleted the expose-nserror branch August 25, 2021 07:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant