Skip to content

Commit

Permalink
Improve error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
mewim committed Nov 1, 2023
1 parent a96af47 commit d8fb800
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/components/ShellView/ShellCell.vue
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,14 @@ export default {
this.errorMessage = String(error).trim();
}
else {
this.errorMessage = error.response.data.error.trim();
console.error(error.response.data.error.trim());
try {
this.errorMessage = error.response.data.error.trim();
console.error(error.response.data.error.trim());
} catch (e) {
const httpStatus = error.response.status;
this.errorMessage = `The request failed with HTTP status code ${httpStatus}: ${error.response.statusText}`;
console.error(`The request failed with HTTP status code ${httpStatus}: ${error.response.statusText}`);
}
}
if (this.errorMessage) {
this.$nextTick(() => {
Expand Down

0 comments on commit d8fb800

Please sign in to comment.