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

Enhance PollerError with associated value #107

Open
mickey-nutmeg opened this issue Feb 11, 2025 · 0 comments · May be fixed by #108
Open

Enhance PollerError with associated value #107

mickey-nutmeg opened this issue Feb 11, 2025 · 0 comments · May be fixed by #108
Labels
enhancement New feature or request

Comments

@mickey-nutmeg
Copy link
Contributor

Describe the feature request

Enhance PollerError with associated value Error, i.e. PollerError.noResponse(Error?).

Background

In Poller.swift: line 129, the function getFeatures(context:completionHandler:) -> Void completes with noResponse error.

guard let httpResponse = response as? HTTPURLResponse else {
    Printer.printMessage("No response")
    completionHandler?(.noResponse)
    return
}

Our iOS project has to catch the exact error from the session to do some other requests, especially for the noResponse error.

Solution suggestions

Providing detailed error in associated values on PollerError. And pass them from getFeatures(context:completionHandler:) -> Void of Poller.swift.

public enum PollerError: Error {
    case decoding(Error)
    case network(Error?)
    case url
    case noResponse(Error?)
    case unhandledStatusCode(Int)
}
@mickey-nutmeg mickey-nutmeg added the enhancement New feature or request label Feb 11, 2025
@FredrikOseberg FredrikOseberg moved this from New to Investigating in Issues and PRs Feb 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Investigating
Development

Successfully merging a pull request may close this issue.

1 participant