Skip to content

INSURLSessionTaskOperation does not surface errors #20

@Frankacy

Description

@Frankacy

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions