mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-20 15:57:57 +01:00
Restore some of Doug's vim-compatible :source error messages. Also, don't crap out so easily on errors.
This commit is contained in:
@@ -141,6 +141,11 @@ const Command = Class("Command", {
|
|||||||
let self = this;
|
let self = this;
|
||||||
modifiers = modifiers || {};
|
modifiers = modifiers || {};
|
||||||
|
|
||||||
|
if (args.count != null && !this.count)
|
||||||
|
throw FailedAssertion("E481: No range allowed");
|
||||||
|
if (args.bang && !this.bang)
|
||||||
|
throw FailedAssertion("E477: No ! allowed");
|
||||||
|
|
||||||
dactyl.trapErrors(function exec(command) {
|
dactyl.trapErrors(function exec(command) {
|
||||||
this.action(args, modifiers);
|
this.action(args, modifiers);
|
||||||
}, this);
|
}, this);
|
||||||
|
|||||||
@@ -393,18 +393,9 @@ const Dactyl = Module("dactyl", {
|
|||||||
|
|
||||||
let err = null;
|
let err = null;
|
||||||
for (let [command, args] in commands.parseCommands(str.replace(/^'(.*)'$/, "$1"))) {
|
for (let [command, args] in commands.parseCommands(str.replace(/^'(.*)'$/, "$1"))) {
|
||||||
if (command === null) {
|
if (command === null)
|
||||||
err = "E492: Not a " + config.name + " command: " + str;
|
throw FailedAssertion("E492: Not a " + config.appName + " command: " + str);
|
||||||
dactyl.focusContent();
|
|
||||||
}
|
|
||||||
else if (command.action === null)
|
|
||||||
err = "E666: Internal error: command.action === null"; // TODO: need to perform this test? -- djk
|
|
||||||
else if (args.count != null && !command.count)
|
|
||||||
err = "E481: No range allowed";
|
|
||||||
else if (args.bang && !command.bang)
|
|
||||||
err = "E477: No ! allowed";
|
|
||||||
|
|
||||||
dactyl.assert(!err, err);
|
|
||||||
if (!silent)
|
if (!silent)
|
||||||
commandline.command = str.replace(/^\s*:\s*/, "");
|
commandline.command = str.replace(/^\s*:\s*/, "");
|
||||||
|
|
||||||
|
|||||||
@@ -386,8 +386,15 @@ lookup:
|
|||||||
line = line.replace(/\r$/, "");
|
line = line.replace(/\r$/, "");
|
||||||
|
|
||||||
if (!/^\s*(".*)?$/.test(line))
|
if (!/^\s*(".*)?$/.test(line))
|
||||||
|
try {
|
||||||
dactyl.execute(line, { setFrom: file }, true);
|
dactyl.execute(line, { setFrom: file }, true);
|
||||||
}
|
}
|
||||||
|
catch (e) {
|
||||||
|
dactyl.echoerr("Error detected while processing " + file.path);
|
||||||
|
dactyl.echomsg("line\t" + this.sourcing.line + ":");
|
||||||
|
dactyl.reportError(e, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this._scriptNames.indexOf(file.path) == -1)
|
if (this._scriptNames.indexOf(file.path) == -1)
|
||||||
|
|||||||
Reference in New Issue
Block a user