refit


Refit.ApiException Error Handling


How do I get to the content of Refit.ApiException?
Depending on what the inner content is, I want to let the user know how to proceed. So I see that thrown exception has the following content ...
Content "{\"error\":\"invalid_grant\",\"error_description\":\"The user name or password is incorrect.\"}"
The question is, how do I access that?
Going through the RestService class https://github.com/paulcbetts/refit/blob/master/Refit/RestService.cs
figured out I could use the GetContentAs method
So just did this..
((Refit.ApiException)ex).GetContentAs<Dictionary<String, String>>())
to parse out the key value content.
You can add one catch block for ApiException. and you can get content from this catch block.
See below:
catch (ApiException ex)
{
var content = ex.GetContentAs<Dictionary<String, String>>();
Debug.WriteLine(ex.Message);
}

Related Links

Refit.ApiException Error Handling

Categories

HOME
php
webview
blast
shinyapps
mousemove
tcsh
ews
semantic-web
openflow
fedora
javafx-8
scheduler
nsstring
game-maker
powermock
ex
webstore
twisted
nest-api
asciimath
rpmbuild
google-sites
angular2-highcharts
backtracking
mime-types
amazon-sns
exchange-server-2010
tortoisemerge
introspection
window-managers
background-color
xdebug
msdeploy
jackrabbit-oak
d3.js-v4
google-play-developer-api
dotcms
tightvnc
delayed-job
fotorama
bootstrap-sass
restful-architecture
des
cordys-opentext
telephonymanager
python-sounddevice
hdiv
icepdf
hypothesis-test
adblock
directwrite
deployd
password-hash
non-linear-regression
sonicmq
nusoap
amazon-elastic-beanstalk
gestures
google-news
email-forwarding
openerp-6
gapi
mifos
xcode6.4
jpda
fuzzer
callouts
maven-release-plugin
highlighting
xcopy
openmrs
directx-9
ampersand
flow-js
clarion
tkx
cout
nidaqmx
otl
ivalueconverter
spring-social-linkedin
lsa
armv6
grails-2.3
lru
ldif
dojo-1.9
semantic-merge
popup-blocker
system-information
java.lang.class
exponent
background-repeat
django-apps
litespeed
groovy-console
vows
css-friendly
pyjamas
ccnet-config
tabbarcontroller
principles
eventaggregator
wmd-editor
fxruby

Resources

Database Users
RDBMS discuss
Database Dev&Adm
javascript
java
csharp
php
android
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App