本文整理匯總了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);