You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've recently come across this issue when add an additionalErrorInterceptor to a chain request.
The protocol ApolloErrorInterceptor has a required method handleErrorAsync(error:chain:request:response:completion:).
When implementing this method, I would like to call the completion on the callback queue which specified by the RequestChain object. However, the callbackQueue is a private method inside RequestChain which prevent me to do so.
I'm wondering if there are any plans to make callbackQueue public?
What I'm currently do is remove the additionalErrorHandler and call handleErrorAsync to make sure it is called on the callback queue.
Hi, i try to retry request from errorinterceptor, after refreshtoken, request sends, but i can't get completion event in fetch method
class RefreshTokenInterceptor: ApolloErrorInterceptor {
private let requestManager: RequestManager
private let bag = DisposeBag()
init(requestManager: RequestManager) {
self.requestManager = requestManager
}
/// Asynchronously handles the receipt of an error at any point in the chain.
///
/// - Parameters:
/// - error: The received error
/// - chain: The chain the error was received on
/// - request: The request, as far as it was constructed
/// - response: [optional] The response, if one was received
/// - completion: The completion closure to fire when the operation has completed. Note that if you call `retry` on the chain, you will not want to call the completion block in this method.
func handleErrorAsync<Operation: GraphQLOperation>(
error: Error,
chain: RequestChain,
request: HTTPRequest<Operation>,
response: HTTPResponse<Operation>?,
completion: @escaping (Result<GraphQLResult<Operation.Data>, Error>) -> Void) {
guard response?.httpResponse.statusCode == 401 else {
completion(.failure(error))
return
}
requestManager.refreshToken()
.subscribe(
onSuccess: { [chain] in
chain.retry(request: request, completion: completion)
},
onError: { error in
completion(.failure(error))
}
)
.disposed(by: bag)
}
}
Version: 0.34.1
Dependency Manager: SPM
Hi,
I've recently come across this issue when add an
additionalErrorInterceptor
to a chain request.The protocol
ApolloErrorInterceptor
has a required methodhandleErrorAsync(error:chain:request:response:completion:)
.When implementing this method, I would like to call the completion on the callback queue which specified by the
RequestChain
object. However, thecallbackQueue
is a private method insideRequestChain
which prevent me to do so.I'm wondering if there are any plans to make
callbackQueue
public?What I'm currently do is remove the
additionalErrorHandler
and callhandleErrorAsync
to make sure it is called on the callback queue.But really what I'm expecting is something like:
Any suggestions are welcomed.
The text was updated successfully, but these errors were encountered: