Moya: How to get Message from server for failure case

Created on 25 Apr 2017  路  10Comments  路  Source: Moya/Moya

How to get the message from server in case of 400( or 4xx/5xx) status code.
IN the failure case , cant obtain the message and status code using moya ...for underlying case

question

All 10 comments

Hey, I think what you need was added in #993. The change is targeted to be released in version 9.0 :wink:

When the version will be available? Till then any temporary workaround for this ?

hey, waiting for your reply..its an urgent ..cant remove the library support. Want to stuck to your library . Its very efficient. For now if you can give any workaround

@iOSUser110 We still don't have an estimate for when 9.0 will be released, as we're still including some breaking changes to it.

What you can do is use a fork of the Moya repo with a branch pointing to a3f0c526ddaf9c10b8044e5121f6272e06e31c27. You can then update your dependency to use your fork and branch:

Cocoapods:

pod 'Moya', :git => 'https://github.com/iOSUser110/Moya.git', :branch => '<your branch>'

Carthage:

github "iOSUser110/Moya" "<your branch>"

Please don't point directly to our 9.0.0-dev as this branch is under active development and is being constantly rebased (which will change commit hashes and may be not be always stable)

Hey thanks a lot,
one doubt here , what is "your branch" , here what is expected ?

@iOSUser110 First you need to fork Moya repo and fetch it locally. Then run these commands inside your fork of Moya:

git checkout -b temp a3f0c52
git push origin temp

The name of the your branch in this case is temp, feel free to name it as you like

Thanks a lot. Able to fix the issue using this solution

Now this change is availbe with latest version.
But not able to update the latest one.
I removed and types again the Moya in podfile.Still it is taking the local version
How to remove this local version

Hey @iOSUser110, try pod repo update before installing version 9. Or just use version in your podfile, like:

pod 'Moya', '~> 9.0'

@sunshinejr
Resolved 馃憤
Thanks ...

Was this page helpful?
0 / 5 - 0 ratings