Commit d810ab84 authored by jackie / Andrea Ida Malkah Klaura's avatar jackie / Andrea Ida Malkah Klaura
Browse files

add API error handling facility

parent c53b4541
export default function handleApiError (vm, err, message) {
if (err.response) {
vm.$log.error(err.response.status + ' ' + err.response.statusText)
vm.$log.error(err.response)
let msg = 'Error: '
if (message) {
msg += message
}
msg += '\n\n'
msg += 'Status code: ' + err.response.status + ' ' + err.response.statusText
alert(msg)
} else {
vm.$log.error(err)
if (message) {
alert('Error: ' + message + '\nInspect the console for more details.')
} else {
alert('Unspecified error. Inspect the console for details.')
}
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment