[fix] Display responseText on API error. #171

This commit is contained in:
opi 2016-02-04 12:25:31 +01:00
parent 8e1e76ea44
commit 978cf6eee7
2 changed files with 7 additions and 2 deletions

File diff suppressed because one or more lines are too long

View file

@ -105,7 +105,12 @@
} else if (typeof xhr.responseJSON !== 'undefined') {
c.flash('fail', xhr.responseJSON.error);
} else if (typeof xhr.statusText !== 'undefined' && uri !== '/postinstall') {
c.flash('fail', y18n.t('api_not_responding', [xhr.status+' '+xhr.statusText]));
var errorMessage = xhr.status+' '+xhr.statusText;
// If some more text is available, display it to user.
if (typeof xhr.responseText !== 'undefined') {
errorMessage += ' - ' + xhr.responseText;
}
c.flash('fail', y18n.t('api_not_responding', [errorMessage]));
} else {
if (uri === '/postinstall') {
if (installing) {