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

INSURLSessionTaskOperation does not surface errors #20

Open
Frankacy opened this issue Jun 19, 2017 · 0 comments
Open

INSURLSessionTaskOperation does not surface errors #20

Frankacy opened this issue Jun 19, 2017 · 0 comments

Comments

@Frankacy
Copy link
Contributor

Hey everyone!

It seems as though it's currently impossible to surface errors from inside INSURLSessionTaskOperation.

I've tried calling -finishWithError: from inside the completion block of my NSURLSessionTask, but the operation is already completed at that point (due to KVO on the 'state' of the sessionTask).

I think there are two ways we can fix this:

  • Change the KVO method to call [self finishWithError:self.task] instead of [self finish] when the URLSessionTask completes. This is a simple fix and shouldn't create any timing issues.
    OR
  • Complete the operation only once the completion block on the NSURLSessionTask has finished running. This would allow the user to surface his own errors instead of the URLSession errors.

What do you all think? Have you experienced the same issue?

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

No branches or pull requests

1 participant