From 34fd140a9e9cc747fb99e5f44dfbff5150734d18 Mon Sep 17 00:00:00 2001 From: liushuyu Date: Fri, 29 May 2020 14:22:58 -0600 Subject: [PATCH] ui: main: more robust error handling in /app/exit --- ui/mock-server.js | 11 ++++++++++- ui/src/main.js | 2 +- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/ui/mock-server.js b/ui/mock-server.js index 31b5d03..fc03b12 100644 --- a/ui/mock-server.js +++ b/ui/mock-server.js @@ -5,6 +5,7 @@ const app = express() const port = 3000 let showError = false +let showConfigError = false let maintenance = false let launcher = false let fileExists = false @@ -30,7 +31,7 @@ function progressSimulation (res) { } function returnConfig (res) { - if (showError) { + if (showConfigError) { res.status(500).json({}) return } @@ -144,6 +145,14 @@ process.argv.forEach((val, index) => { darkMode = true console.log('Simulating dark mode') break + case 'config-error': + showConfigError = true + console.log('Simulating configuration errors') + break + case 'error': + showError = true + console.log('Simulating errors') + break } }) diff --git a/ui/src/main.js b/ui/src/main.js index 9d3cf11..6544040 100644 --- a/ui/src/main.js +++ b/ui/src/main.js @@ -124,7 +124,7 @@ var app = new Vue({ methods: { exit: function () { axios.get('/api/exit').catch(function (msg) { - var searchLocation = app.metadata.install_path.length > 0 ? app.metadata.install_path + var searchLocation = (app.metadata.install_path && app.metadata.install_path.length > 0) ? app.metadata.install_path : i18n.t('error.location_unknown') app.$router.replace({