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

Use ConnectError.unavailable when URLSession is offline #328

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

rebello95
Copy link
Collaborator

Resolves #325.

When turning the device's wifi off, the following was observed:

Before:

▿ Optional<ConnectError>
  ▿ some : ConnectError
    - code : Connect.Code.unknown
    ▿ message : Optional<String>
      - some : "The Internet connection appears to be offline."
    ▿ exception : Optional<Error>
      - some : Error Domain=NSURLErrorDomain Code=-1009 "The Internet connection appears to be offline." 

After:

▿ Optional<ConnectError>
  ▿ some : ConnectError
    - code : Connect.Code.unavailable
    ▿ message : Optional<String>
      - some : "The Internet connection appears to be offline."
    ▿ exception : Optional<Error>
      - some : Error Domain=NSURLErrorDomain Code=-1009 "The Internet connection appears to be offline." 

@rebello95 rebello95 requested a review from jhump December 23, 2024 17:34
@rebello95 rebello95 changed the title Use unavailable ConnectError when URLSession is offline Use ConnectError.unavailable when URLSession is offline Dec 23, 2024
Signed-off-by: Michael Rebello <[email protected]>
@aheze
Copy link

aheze commented Dec 23, 2024

Btw does this work for NIOHttpClient?

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.

No distinct error code for lack of internet access
2 participants