mirror of
https://github.com/linux-odyssey/linux-odyssey.git
synced 2026-11-08 19:40:11 +08:00
fix: add error handling
This commit is contained in:
1 parent
eb9118d5b1
commit
c7f52b1003
1 file changed
+18
@@ -50,9 +50,18 @@ export default class CommandHandler extends SessionHandler {
|
||||
}
|
||||
|
||||
async discoverHandler() {
|
||||
try {
|
||||
const graph = new FileGraph(this.session.graph)
|
||||
graph.discover(this.params.discover)
|
||||
this.session.graph = graph
|
||||
} catch (e) {
|
||||
logger.error('Update file graph failed', {
|
||||
error: e,
|
||||
session: this.session.id,
|
||||
graph: this.session.graph,
|
||||
discover: this.params.discover,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
async isMatch(condition) {
|
||||
@@ -111,6 +120,7 @@ export default class CommandHandler extends SessionHandler {
|
||||
}
|
||||
|
||||
async run() {
|
||||
try {
|
||||
this.quest = await Quest.findById(this.session.quest)
|
||||
const stages = this.getStages()
|
||||
if (stages.length === 0) {
|
||||
@@ -143,5 +153,13 @@ export default class CommandHandler extends SessionHandler {
|
||||
end: this.session.status === 'finished',
|
||||
...response,
|
||||
}
|
||||
} catch (err) {
|
||||
logger.error('CommandHandler error', {
|
||||
error: err,
|
||||
session: this.session.id,
|
||||
command: this.commandInput,
|
||||
})
|
||||
return {}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user