This is an automated email from the ASF dual-hosted git repository.

dahn pushed a commit to branch 4.20
in repository https://gitbox.apache.org/repos/asf/cloudstack.git


The following commit(s) were added to refs/heads/4.20 by this push:
     new bce3e54a7e4 improve error handling for template upload notifications 
(#12412)
bce3e54a7e4 is described below

commit bce3e54a7e46216917acfe2f1ba1e2a9c9b12128
Author: Daman Arora <[email protected]>
AuthorDate: Thu Jan 22 09:02:46 2026 -0500

    improve error handling for template upload notifications (#12412)
    
    Co-authored-by: Daman Arora <[email protected]>
---
 ui/src/utils/plugins.js                         | 13 +++++++------
 ui/src/views/image/RegisterOrUploadTemplate.vue |  6 +-----
 2 files changed, 8 insertions(+), 11 deletions(-)

diff --git a/ui/src/utils/plugins.js b/ui/src/utils/plugins.js
index a07f8178604..0ec957c8729 100644
--- a/ui/src/utils/plugins.js
+++ b/ui/src/utils/plugins.js
@@ -218,18 +218,19 @@ export const notifierPlugin = {
         if (error.response.status) {
           msg = `${i18n.global.t('message.request.failed')} 
(${error.response.status})`
         }
-        if (error.message) {
-          desc = error.message
-        }
-        if (error.response.headers && 'x-description' in 
error.response.headers) {
+        if (error.response.headers?.['x-description']) {
           desc = error.response.headers['x-description']
-        }
-        if (desc === '' && error.response.data) {
+        } else if (error.response.data) {
           const responseKey = _.findKey(error.response.data, 'errortext')
           if (responseKey) {
             desc = error.response.data[responseKey].errortext
+          } else if (typeof error.response.data === 'string') {
+            desc = error.response.data
           }
         }
+        if (!desc && error.message) {
+          desc = error.message
+        }
       }
       let countNotify = store.getters.countNotify
       countNotify++
diff --git a/ui/src/views/image/RegisterOrUploadTemplate.vue 
b/ui/src/views/image/RegisterOrUploadTemplate.vue
index 76df7b246aa..3ada9f6fd53 100644
--- a/ui/src/views/image/RegisterOrUploadTemplate.vue
+++ b/ui/src/views/image/RegisterOrUploadTemplate.vue
@@ -638,11 +638,7 @@ export default {
         this.$emit('refresh-data')
         this.closeAction()
       }).catch(e => {
-        this.$notification.error({
-          message: this.$t('message.upload.failed'),
-          description: 
`${this.$t('message.upload.template.failed.description')} -  ${e}`,
-          duration: 0
-        })
+        this.$notifyError(e)
       })
     },
     fetchCustomHypervisorName () {

Reply via email to