ui: main: more robust error handling in /app/exit

This commit is contained in:
liushuyu 2020-05-29 14:22:58 -06:00 committed by James
parent cd7fb8de28
commit 34fd140a9e
2 changed files with 11 additions and 2 deletions

View File

@ -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
}
})

View File

@ -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({