-
Notifications
You must be signed in to change notification settings - Fork 734
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
improve HTTPNetworkTransportRetryDelegate to enable returning custom error #1128
Conversation
…dError:for:,response:retryHandler:) to enable returning custom error
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please add a test validating that your feature request is working the way you think it should - that is, on a retry, you get the correct error?
@@ -59,11 +59,52 @@ public protocol HTTPNetworkTransportRetryDelegate: HTTPNetworkTransportDelegate | |||
/// - request: The URLRequest which generated the error | |||
/// - response: [Optional] Any response received when the error was generated | |||
/// - retryHandler: A closure indicating whether the operation should be retried. Asyncrhonous to allow for re-authentication or other async operations to complete. | |||
@available(*, deprecated, message: "Use networkTransport(_:receivedError:for:,response:continueHandler:) instead") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So this is going to be a bit of a mess because even if we deprecate this method, people are still going to have the deprecation warning on the default implementation below.
I'm wondering if this might be a "Let's take advantage of the fact that we're not at 1.0" moment to just straight up replace this method.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm, I don't see deprecation warning unless I implement method in my delegate. Or I'm missing something?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm...in theory this should still cause a deprecation warning where it's in the same file but maybe that's been disabled to prevent exactly this scenario...
added test. Not rly in style you doing, so let me know if you want me to change it |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apologies for not getting back to you on this sooner, I was a bit under the weather. Starting to shape up!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Smashing! Thanks so much for your hard work on this.
solves use case described in #1121 where delegate might want to return different error depending on logic