when the responseText contains a plain message instead of JSON, the code would throw an exception here that we don't catch and not show an error, but also not progressing with the upload.
Catch the error, and show the originally generated message if responseText is not valid JSON. Signed-off-by: Dominik Csapak <d.csa...@proxmox.com> --- While testing upload errors to see if we can get a better error message than 'Error 0 occurred', i noticed that in chrome we fail here to show the valid error message. Note that this does not improve the 'Error 0' message, only cases where the browser fails on a different path. www/manager6/window/UploadToStorage.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/www/manager6/window/UploadToStorage.js b/www/manager6/window/UploadToStorage.js index cc53596d..96d8dabf 100644 --- a/www/manager6/window/UploadToStorage.js +++ b/www/manager6/window/UploadToStorage.js @@ -115,9 +115,14 @@ Ext.define('PVE.window.UploadToStorage', { const err = Ext.htmlEncode(xhr.statusText); let msg = `${gettext('Error')} ${xhr.status.toString()}: ${err}`; if (xhr.responseText !== '') { - const result = Ext.decode(xhr.responseText); - result.message = msg; - msg = Proxmox.Utils.extractRequestError(result, true); + try { + const result = Ext.decode(xhr.responseText); + result.message = msg; + msg = Proxmox.Utils.extractRequestError(result, true); + } catch (_e) { + // we could not decode the responseText, so it's + // probably not json, so show initial error message + } } Ext.Msg.alert(gettext('Error'), msg, (btn) => view.close()); }, -- 2.39.5 _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel