From e9d40e447bb63c0fa3f3fe4373adb918e5a47a61 Mon Sep 17 00:00:00 2001 From: Martin Aeschlimann Date: Thu, 20 Oct 2016 09:32:14 +0200 Subject: [PATCH] Provide detailed argument error message on registerDefaultLanguageCommand --- src/vs/editor/common/editorCommonExtensions.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/vs/editor/common/editorCommonExtensions.ts b/src/vs/editor/common/editorCommonExtensions.ts index 9967cc7266f..86d1cbbb1a5 100644 --- a/src/vs/editor/common/editorCommonExtensions.ts +++ b/src/vs/editor/common/editorCommonExtensions.ts @@ -134,13 +134,16 @@ export module CommonEditorRegistry { registerLanguageCommand(id, function (accessor, args) { const {resource, position} = args; - if (!(resource instanceof URI) || !Position.isIPosition(position)) { - throw illegalArgument(); + if (!(resource instanceof URI)) { + throw illegalArgument('resource'); + } + if (!Position.isIPosition(position)) { + throw illegalArgument('position'); } const model = accessor.get(IModelService).getModel(resource); if (!model) { - throw illegalArgument(); + throw illegalArgument('Can not find open model for ' + resource); } const editorPosition = Position.lift(position); -- GitLab