use try catch to guard against errors in commands

This commit is contained in:
nightwing 2012-04-25 00:33:41 +04:00
commit c427956d0e

View file

@ -33,7 +33,17 @@ oop.inherits(CommandManager, HashHandler);
if (editor && editor.$readOnly && !command.readOnly)
return false;
var retvalue = this._emit("exec", {editor: editor, command: command, args: args});
try {
var retvalue = this._emit("exec", {
editor: editor,
command: command,
args: args
});
} catch (e) {
window.console && window.console.log(e);
return true;
}
return retvalue === false ? false : true;
};