1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-20 11:18:00 +01:00

improve user-command custom completer error handling

This commit is contained in:
Doug Kearns
2008-12-18 01:33:48 +11:00
parent 44589146fe
commit 2d9d4736d6

View File

@@ -776,13 +776,20 @@ function Commands() //{{{
{ {
try try
{ {
liberator.eval(completeFunc).call(completion, context, args) var completer = liberator.eval(completeFunc);
if (!(completer instanceof Function))
throw new TypeError("User-defined custom completer '" + completeFunc + "' is not a function");
} }
catch (e) catch (e)
{ {
// FIXME: should be pushed to the MOW // FIXME: should be pushed to the MOW
liberator.echoerr("E117: Unknown function: " + completeFunc); liberator.echoerr("E117: Unknown function: " + completeFunc);
liberator.log(e);
return;
} }
completer.call(completion, context, args)
} }
}, },
replacementText: args.literalArg replacementText: args.literalArg