mirror of
https://github.com/godotengine/godot-vscode-plugin.git
synced 2026-01-04 10:09:58 +03:00
Add exception handling during trigger command (#179)
This commit is contained in:
@@ -29,12 +29,6 @@ export class CommandParser {
|
||||
return new CommandMessageInspectObject();
|
||||
},
|
||||
],
|
||||
[
|
||||
"message:scene_tree",
|
||||
function () {
|
||||
return new CommandMessageSceneTree();
|
||||
},
|
||||
],
|
||||
[
|
||||
"stack_dump",
|
||||
function () {
|
||||
@@ -126,9 +120,23 @@ export class CommandParser {
|
||||
this.parameters.push(dataset.shift());
|
||||
if (this.current_command.param_count !== -1) {
|
||||
if (this.current_command.param_count === this.parameters.length) {
|
||||
this.current_command.trigger(this.parameters);
|
||||
this.current_command = undefined;
|
||||
try {
|
||||
this.current_command.trigger(this.parameters);
|
||||
} catch (e) {
|
||||
// FIXME: Catch exception during trigger command: TypeError: class_name.replace is not a function
|
||||
// class_name is the key of Mediator.inspect_callbacks
|
||||
console.error("Catch exception during trigger command: " + e);
|
||||
} finally {
|
||||
this.current_command = undefined;
|
||||
this.parameters = [];
|
||||
}
|
||||
} else if(this.current_command.param_count < this.parameters.length) {
|
||||
// we debugged that an exception occures during this.current_command.trigger(this.parameters)
|
||||
// because we do not understand the root cause of the exception, we set the current command to undefined
|
||||
// to avoid a infinite loop of parse_message(...)
|
||||
this.current_command = undefined
|
||||
this.parameters = [];
|
||||
console.log("Exception not catched. Reset current_command to avoid infinite loop.")
|
||||
}
|
||||
} else {
|
||||
this.current_command.param_count = this.parameters.shift();
|
||||
|
||||
Reference in New Issue
Block a user