提交 25d82973 编写于 作者: D Dirk Baeumer

Fixes #30758: Trying to customize a task without a task definition causes an exception

上级 52ac8ab3
...@@ -793,7 +793,7 @@ namespace CommandConfiguration { ...@@ -793,7 +793,7 @@ namespace CommandConfiguration {
if (Types.isStringArray(config.args)) { if (Types.isStringArray(config.args)) {
result.args = config.args.slice(0); result.args = config.args.slice(0);
} else { } else {
context.problemReporter.fatal(nls.localize('ConfigurationParser.noargs', 'Error: command arguments must be an array of strings. Provided value is:\n{0}', config.args ? JSON.stringify(config.args, undefined, 4) : 'undefined')); context.problemReporter.error(nls.localize('ConfigurationParser.noargs', 'Error: command arguments must be an array of strings. Provided value is:\n{0}', config.args ? JSON.stringify(config.args, undefined, 4) : 'undefined'));
} }
} }
if (config.options !== void 0) { if (config.options !== void 0) {
...@@ -1125,10 +1125,15 @@ namespace ConfiguringTask { ...@@ -1125,10 +1125,15 @@ namespace ConfiguringTask {
let type = external.type; let type = external.type;
let customize = (external as CustomizeShape).customize; let customize = (external as CustomizeShape).customize;
if (!type && !customize) { if (!type && !customize) {
context.problemReporter.fatal(nls.localize('ConfigurationParser.noTaskType', 'Error: tasks configuration must have a type property. The configuration will be ignored.\n{0}\n', JSON.stringify(external, null, 4))); context.problemReporter.error(nls.localize('ConfigurationParser.noTaskType', 'Error: tasks configuration must have a type property. The configuration will be ignored.\n{0}\n', JSON.stringify(external, null, 4)));
return undefined; return undefined;
} }
let typeDeclaration = TaskDefinitionRegistry.get(type); let typeDeclaration = TaskDefinitionRegistry.get(type);
if (!typeDeclaration) {
let message = nls.localize('ConfigurationParser.noTypeDefinition', 'Error: there is not registered task type \'{0}\'. Did you miss to install an extension that provides a corresponding task provider?', type);
context.problemReporter.error(message);
return undefined;
}
let identifier: TaskIdentifier; let identifier: TaskIdentifier;
if (Types.isString(customize)) { if (Types.isString(customize)) {
if (customize.indexOf(grunt) === 0) { if (customize.indexOf(grunt) === 0) {
...@@ -1198,12 +1203,12 @@ namespace CustomTask { ...@@ -1198,12 +1203,12 @@ namespace CustomTask {
type = 'custom'; type = 'custom';
} }
if (type !== 'custom' && type !== 'shell' && type !== 'process') { if (type !== 'custom' && type !== 'shell' && type !== 'process') {
context.problemReporter.fatal(nls.localize('ConfigurationParser.notCustom', 'Error: tasks is not declared as a custom task. The configuration will be ignored.\n{0}\n', JSON.stringify(external, null, 4))); context.problemReporter.error(nls.localize('ConfigurationParser.notCustom', 'Error: tasks is not declared as a custom task. The configuration will be ignored.\n{0}\n', JSON.stringify(external, null, 4)));
return undefined; return undefined;
} }
let taskName = external.taskName; let taskName = external.taskName;
if (!taskName) { if (!taskName) {
context.problemReporter.fatal(nls.localize('ConfigurationParser.noTaskName', 'Error: tasks must provide a taskName property. The task will be ignored.\n{0}\n', JSON.stringify(external, null, 4))); context.problemReporter.error(nls.localize('ConfigurationParser.noTaskName', 'Error: tasks must provide a taskName property. The task will be ignored.\n{0}\n', JSON.stringify(external, null, 4)));
return undefined; return undefined;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册