本文整理汇总了TypeScript中vso-task-lib/vsotask.error函数的典型用法代码示例。如果您正苦于以下问题:TypeScript error函数的具体用法?TypeScript error怎么用?TypeScript error使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了error函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: conflicts
}
// now that all the branches are local, test the merges
errors = 0;
for (var i = 0; i < branchesToMerge.length; i++) {
var branch = branchesToMerge[i].trim();
if (ut.merge(branch, false)) {
console.info(`No merge conflicts detected when merging ${branch}`);
if (testMergeAll) {
// if we're testing all the merges, then we need to commit before
// merging the next branch
if (!ut.commit("Testing merge")) {
errors++;
tl.error("Commit failed");
break;
}
} else {
ut.abortMerge();
}
} else {
errors++;
tl.error(`Merge ${branch} operation has conflicts (or failed)`);
}
}
// clean up
ut.checkoutCommit(commitId);
// fail the task if there were errors
示例2: RegExp
console.info(`Using prefix [${replacePrefix}] and version [${versionNum}] in folder [${sourcePath}]`);
var filesToReplace = tl.glob(`${sourcePath}\\${filePattern}`);
if (filesToReplace === undefined || filesToReplace.length === 0) {
tl.warning("No files found");
} else {
for (var i = 0; i < filesToReplace.length; i++) {
var file = filesToReplace[i];
console.info(`Changing version in ${file}`);
var contents = fs.readFileSync(file, 'utf8').toString();
var checkMatches = new RegExp(replaceRegex).exec(contents);
if (!checkMatches || checkMatches.length === 0) {
if (failIfNoMatchFound) {
tl.error(`No matches for regex [${replaceRegex}] found in file ${file}`);
process.exit(1);
} else {
tl.warning(`No matches for regex [${replaceRegex}] found in file ${file}`);
}
} else {
console.info(`${checkMatches.length} matches for regex [${replaceRegex}] found in file ${file}`);
// make the file writable
sh.chmod(666, file);
// replace all occurrences by adding g to the pattern
sh.sed("-i", new RegExp(replaceRegex, "g"), replacePrefix + versionNum, file);
}
}
console.info(`Processed ${filesToReplace.length} files`);
}
示例3: conflicts
// now that all the branches are local, test the merges
errors = 0;
for (var i = 0; i < branchesToMerge.length; i++) {
var branch = branchesToMerge[i].trim();
var mergeRes = ut.merge(branch, false);
if (mergeRes.code === 0) {
console.info(`No merge conflicts detected when merging ${branch}`);
if (testMergeAll) {
// if we're testing all the merges, then we need to commit before
// merging the next branch
if (!ut.commit("Testing merge")) {
errors++;
tl.error("Commit failed");
break;
}
} else {
if (mergeRes.stdout.indexOf('Already up-to-date') < 0) {
ut.abortMerge();
}
}
} else {
errors++;
tl.error(`Merge ${branch} operation has conflicts (or failed)`);
}
}
// clean up
ut.checkoutCommit(sourceCommitId);