vue.js


Handle unavailable server with vue-resource


Is there a way to handle errors with vue-resource when a HTTP response has not been received?
For example, when the backend server is unavailable (i.e. http://localhost:30000 doesn't exist) I receive the following error in Safari:
[Error] Failed to load resource: Could not connect to the server. (create, line 0)
However the vue-resource response object passed to the error callback is empty (doesn't give any indication about the failure to connect to the server):
{ "url": "http://localhost:30000", "ok": false, "status": 0, "statusText": "", "headers": { "map": { "": [ "" ] } }, "body": null }
What is the best way to handle this? Hardcoding for a status === 0 seems like it might be overly generic?

Related Links

Failed to mount component: template or render function not defined
Vue How to set property on a component with parent and in itself? [Warn]
Vue.js: Detect change in nested data
How to trigger a transition when a component is reused?
Bootstraping with vue 2, router and vue-loader
Attaching data (body) to $http.delete event in VueJS
Initialize VueJs after opening new tab
What is the recommended approach for preventing navigation for a subroute?
Emit an event when a specific piece of state changes in vuex store
Vue Router Error
$nextTick, show/hide and VueX
How to pass dynamic data to a component?
Global catch for submit forms in Vue.js 2.0
Add character to attribute in VueJs Templating
Vue: Can't iterate Object
Vue 2 vue-router 2 laravel 5.3 issue

Categories

HOME
npm
winapi
wmic
google-contacts
formal-verification
memory-leaks
computer-vision
docker-swarm
recyclerview
java-home
iis-7.5
file-io
openwrt
dropbox
dropbear
lagom
data-analysis
postmessage
typeahead
ida
cairo
grub2
anychart
movies
attask
styles
ejbca
ios10.3
jconsole
flexboxgrid
excel-2010
tcpclient
explode
cronet
ui5
invoke-command
canvasjs
geomesa
google-guava-cache
shibboleth
liquid-xml
resuming-training
matlab-cvst
timesten
defold
broadcast
goquery
xmgrace
rollback
tcserver
paas
adler32
sqlexception
linkageerror
database-backups
brython
remoteapp
elastix
financial
aerogear
license-key
selendroid
risk-analysis
connection-reset
castle-windsor-3
apache-mina
hg-git
sqoop2
start-job
client-side-validation
c++-actor-framework
belongs-to
cpu-speed
qtestlib
errorprovider
jstat
cppdepend
resource-files
mimosa
magicalrecord-2.2
resgen
pep8
xslkey
cgpath
android-4.0
osi
ou
tcxgrid
easygui
audiostreamer
getresource
scala-2.8
chdatastructures
nt4

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App