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
Carthage users can point to this repository and use whichever generated framework they'd like, Moya, RxMoya, or ReactiveMoya. The full Moya framework is bundled in each of those frameworks; importing more than one framework in a single file will result in ambiguous lookups at compile time.
This appears to be true for basic usage. However, I get undefined symbol errors for Response if I don't also include Moya with RxMoya. I run into this whenever I want to create custom Rx operators for Observable<Response>. I have not run into any ambiguous lookups yet.
In docs/RxSwift.md
In the error cases, the error's domain is MoyaErrorDomain. The code is one of MoyaErrorCode's rawValues, where appropriate. Wherever possible, underlying errors are provided and the original response data is included in the NSError's userInfo dictionary using the "data" key.
The domain of the NSError that I see is Moya.Error. Also, it doesn't appear that the userInfo dictionary contains any items, and I can't see where in the code this would be the case. Maybe there is some magic happening under the hood when bridging Error to NSError?
In any case, when I need to process the response in error cases, I don't bridge to NSError and instead:
if
let error = error as?Moya.Error,let data = error.response?.data
{// Do something with the data}
The text was updated successfully, but these errors were encountered:
Well, at least my reading of the docs lead me to believe that I could extract the original response data by casting the Moya.Error to an NSError and then retrieving its userInfo["data"] value. That didn't work for me. Retrieving the response is straightforward the way I mentioned above, it's just different than what the docs say.
@scottrhoyt thank you for checking out the README. The issue you ran into with RxMoya not having Response defined stems from changes made in #563.
Previously both RxMoya and ReactiveMoya were fat (they also contained all of the Moya source code), but this change made them slim (they dont contain Moya, so are dependent on Moya being imported as well).
Not updating the README was an oversight, it should have been updated in tandem with #563. We should create a pull request to update that documentation.
In
README.md
This appears to be true for basic usage. However, I get undefined symbol errors for
Response
if I don't also includeMoya
withRxMoya
. I run into this whenever I want to create custom Rx operators forObservable<Response>
. I have not run into any ambiguous lookups yet.In
docs/RxSwift.md
The domain of the
NSError
that I see isMoya.Error
. Also, it doesn't appear that theuserInfo
dictionary contains any items, and I can't see where in the code this would be the case. Maybe there is some magic happening under the hood when bridgingError
toNSError
?In any case, when I need to process the response in error cases, I don't bridge to
NSError
and instead:The text was updated successfully, but these errors were encountered: