Skip to content

Commit a2c3c41

Browse files
committed
quick error handling fix
1 parent 373ebf5 commit a2c3c41

File tree

2 files changed

+5
-10
lines changed

2 files changed

+5
-10
lines changed

frontend/src/chat/chat-message-script/chat-message-script.html

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,11 +90,9 @@
9090
</svg>
9191
</div>
9292
<div class="ml-3">
93-
<h3 class="text-sm font-medium text-red-800">There were {{createErrors.length}} errors with your submission</h3>
93+
<h3 class="text-sm font-medium text-red-800">Error</h3>
9494
<div class="mt-2 text-sm text-red-700">
95-
<ul role="list" class="list-disc space-y-1 pl-5">
96-
<li v-for="error in createErrors">{{error}}</li>
97-
</ul>
95+
{{createError}}
9896
</div>
9997
</div>
10098
</div>

frontend/src/chat/chat-message-script/chat-message-script.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ module.exports = app => app.component('chat-message-script', {
1414
showCreateDashboardModal: false,
1515
newDashboardTitle: '',
1616
dashboardCode: '',
17-
createErrors: [],
17+
createError: null,
1818
dashboardEditor: null
1919
};
2020
},
@@ -61,16 +61,13 @@ module.exports = app => app.component('chat-message-script', {
6161
title: this.newDashboardTitle
6262
}).catch(err => {
6363
if (err.response?.data?.message) {
64-
console.log(err.response.data);
6564
const message = err.response.data.message.split(': ').slice(1).join(': ');
66-
this.createErrors = message.split(',').map(error => {
67-
return error.split(': ').slice(1).join(': ').trim();
68-
});
65+
this.createError = message;
6966
throw new Error(err.response?.data?.message);
7067
}
7168
throw err;
7269
});
73-
this.createErrors.length = 0;
70+
this.createError = null;
7471
this.showCreateDashboardModal = false;
7572
this.$router.push('/dashboard/' + dashboard._id);
7673
},

0 commit comments

Comments
 (0)