Dump whole errors for app installation progress

Sometimes on error we get random strings for the installationProgresss,
as those contain the upstream errors :-/
We now at least attempt to show that so the user may give us the real
error not some wrongly parsed bits from that.
In the long run we have to make that a real structure to give sane error
messages
This commit is contained in:
Johannes Zellner
2017-04-05 16:42:11 +02:00
parent 51d5b96fa1
commit 188f000507

View File

@@ -902,12 +902,18 @@ angular.module('Application').service('Client', ['$http', 'md5', 'Notification',
app.iconUrl = icons.cloudron;
app.iconUrlStore = icons.store;
// FIXME have a real message structure, not some string to randomly parse
// extract progress percentage
var installationProgress = app.installationProgress || '';
var progress = parseInt(installationProgress.split(',')[0], 10);
if (isNaN(progress)) progress = 0;
app.progress = progress;
app.message = installationProgress.replace(/.*, /,'');
// Unfortunatelly some errors are not actual progress messages, but still have a number in fron like a http status code
if (isNaN(progress) || progress > 100) {
app.progress = 0;
app.message = installationProgress;
} else {
app.progress = progress;
app.message = installationProgress.replace(/.*, /,'');
}
return app;
};