mirror of
https://github.com/linux-odyssey/linux-odyssey.git
synced 2026-11-06 03:20:13 +08:00
fix: wrap all async controller with error handler
* add validations to newCommand
This commit is contained in:
1 parent
1af85651b8
commit
c2dac8d385
13 files changed
+120
-120
No files matched your search
@@ -48,7 +48,7 @@ async function main() {
|
||||
},
|
||||
})
|
||||
|
||||
const additionalData = await handleCommand(CMD_NAME)
|
||||
const params = await handleCommand(CMD_NAME)
|
||||
|
||||
const output = await readOrNone(CMD_OUTPUT_FILE)
|
||||
const error = await readOrNone(CMD_ERROR_FILE)
|
||||
@@ -58,7 +58,7 @@ async function main() {
|
||||
error,
|
||||
exit_code: CMD_EXIT_CODE,
|
||||
pwd: PWD,
|
||||
...additionalData,
|
||||
params,
|
||||
}
|
||||
try {
|
||||
const res = await api.post('/commands', payload)
|
||||
@@ -77,7 +77,11 @@ async function main() {
|
||||
console.log(colorize('Quest completed!', 'blue'))
|
||||
}
|
||||
} catch (err) {
|
||||
console.error(err)
|
||||
if (err.response) {
|
||||
console.error(err.response.data)
|
||||
return
|
||||
}
|
||||
console.error(err.message)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user