当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript task.error函数代码示例

本文整理汇总了TypeScript中vsts-task-lib/task.error函数的典型用法代码示例。如果您正苦于以下问题:TypeScript error函数的具体用法?TypeScript error怎么用?TypeScript error使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了error函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1:

	.fail(err => {
		tl.error(tl.loc("CouldNotFindServiceEndpoint", area));
		tl.error(err);
		tl.exit(1);
		return '';

	})
开发者ID:ivyzhu,项目名称:vsts-tasks,代码行数:7,代码来源:LocationHelpers.ts

示例2: getVsTestRunnerDetails

export function getVsTestRunnerDetails(testConfig: models.TestConfigurations) {
    const vstestexeLocation = locateVSTestConsole(testConfig);
    const vstestLocationEscaped = vstestexeLocation.replace(/\\/g, '\\\\');
    const wmicTool = tl.tool('wmic');
    const wmicArgs = ['datafile', 'where', 'name=\''.concat(vstestLocationEscaped, '\''), 'get', 'Version', '/Value'];
    wmicTool.arg(wmicArgs);
    let output = wmicTool.execSync({ silent: true } as tr.IExecSyncOptions).stdout;

    if (utils.Helper.isNullOrWhitespace(output)) {
        tl.error(tl.loc('ErrorReadingVstestVersion'));
        throw new Error(tl.loc('ErrorReadingVstestVersion'));
    }
    output = output.trim();
    tl.debug('VSTest Version information: ' + output);
    const verSplitArray = output.split('=');
    if (verSplitArray.length !== 2) {
        tl.error(tl.loc('ErrorReadingVstestVersion'));
        throw new Error(tl.loc('ErrorReadingVstestVersion'));
    }

    const versionArray = verSplitArray[1].split('.');
    if (versionArray.length !== 4) {
        tl.warning(tl.loc('UnexpectedVersionString', output));
        throw new Error(tl.loc('UnexpectedVersionString', output));
    }

    const majorVersion = parseInt(versionArray[0]);
    const minorVersion = parseInt(versionArray[1]);
    const patchNumber = parseInt(versionArray[2]);

    ci.publishEvent({ testplatform: `${majorVersion}.${minorVersion}.${patchNumber}` });

    if (isNaN(majorVersion) || isNaN(minorVersion) || isNaN(patchNumber)) {
        tl.warning(tl.loc('UnexpectedVersionNumber', verSplitArray[1]));
        throw new Error(tl.loc('UnexpectedVersionNumber', verSplitArray[1]));
    }

    switch (majorVersion) {
        case 14:
            testConfig.vsTestVersionDetails = new version.Dev14VSTestVersion(vstestexeLocation, minorVersion, patchNumber);
            break;
        case 15:
            testConfig.vsTestVersionDetails = new version.Dev15VSTestVersion(vstestexeLocation, minorVersion, patchNumber);
            break;
        default:
            testConfig.vsTestVersionDetails = new version.VSTestVersion(vstestexeLocation, majorVersion, minorVersion, patchNumber);
            break;
    }
}
开发者ID:bleissem,项目名称:vsts-tasks,代码行数:49,代码来源:versionfinder.ts

示例3:

 }).stderr.on('data', (data) => {
     stdErrWritten = true;
     tl.debug('stderr = ' + data);
     if (data && data.toString().trim() !== '') {
         tl.error(data);
     }
 });
开发者ID:Microsoft,项目名称:vsts-tasks,代码行数:7,代码来源:ssh2helpers.ts

示例4: installVsTestPlatformToolFromCustomFeed

    // Installs the test platform from a custom feed provided by the user along with credentials for authentication against said feed
    public async installVsTestPlatformToolFromCustomFeed(packageSource: string, versionSelectorInput: string, testPlatformVersion: string, username: string, password: string) {
        let tempConfigFilePath = null;
        try {
            try {
                if (!helpers.isNullEmptyOrUndefined(password)) {
                    tl.debug('Attempting to write feed details along with provided credentials to temporary config file.');
                    tempConfigFilePath = helpers.GenerateTempFile(`${uuid.v1()}.config`);
                    const feedId = uuid.v1();
                    this.prepareNugetConfigFile(packageSource, tempConfigFilePath, username, password, feedId);
                    packageSource = feedId;
                    ci.addToConsolidatedCi('passwordProvided', 'true');
                    ci.addToConsolidatedCi('usernameProvided', `${!helpers.isNullEmptyOrUndefined(username)}`);
                } else {
                    packageSource = tl.getInput(constants.customFeed);
                    tl.debug(`Credentials were not provided. Skipping writing to config file. Will use custom package feed provided by user ${packageSource}`);
                }
            } catch (error) {
                tl.error(error);
                console.log(tl.loc('LatestStableCached'));
                // Look for the latest stable version available in the cache as a fallback.
                testPlatformVersion = 'x';
                tempConfigFilePath = null;
            }

            await this.installVsTestPlatformToolFromSpecifiedFeed(packageSource, testPlatformVersion, versionSelectorInput, tempConfigFilePath);

        } finally {
            helpers.cleanUpTempConfigFile(tempConfigFilePath);
        }
    }
开发者ID:shubham90,项目名称:vsts-tasks,代码行数:31,代码来源:nugetfeedinstaller.ts

示例5: createAgent

 public static async createAgent(environment: models.DtaEnvironment, retries: number) {
     var currentRetryCount = retries;
     while(currentRetryCount > 0) {
         currentRetryCount--;
         try {
             const envUrlRef: any = { Url: environment.environmentUri };
             const machineNameRef: any = { Name: environment.agentName };
             // TODO : Change any to appropriate types once promiseme package is avialable
             const testAgent: any = {
                                 Name: environment.agentName,
                                 Capabilities: [],
                                 DtlEnvironment: envUrlRef,
                                 DtlMachine: machineNameRef };
             const webapi: any = new webapim.WebApi(environment.tfsCollectionUrl, webapim.getBearerHandler(environment.patToken));
             const testApi: any = webapi.getTestApi();
             const registeredAgent = await testApi.createAgent(testAgent);
             tl.debug('created the test agent entry in DTA service, id : ' + registeredAgent.id);
             return registeredAgent.id;
         } catch (error) {
             tl.error('Error : created the test agent entry in DTA service, so retrying => retries pending  : ' + currentRetryCount
                     + 'error details :' + error);
             if(currentRetryCount === 0) {
                 throw new Error(tl.loc("configureDtaAgentFailed", retries, error));
             }
         }
     }
 }
开发者ID:bleissem,项目名称:vsts-tasks,代码行数:27,代码来源:testagent.ts

示例6: run

async function run() {
    try {
        const connection = utils.getDefaultOctopusConnectionDetailsOrThrow();
        
        const space = tasks.getInput("Space");
        const packages = utils.getLineSeparatedItems(tasks.getInput("Package", true));
        const replace = tasks.getBoolInput("Replace");
        const additionalArguments = tasks.getInput("AdditionalArguments");

        const octo = await utils.getOrInstallOctoCommandRunner("push");
        const matchedPackages = await utils.resolveGlobs(packages);

        const configure = [
            connectionArguments(connection),
            argumentIfSet(argumentEnquote, "space", space),
            multiArgument(argumentEnquote, "package", matchedPackages),
            flag("replace-existing", replace),
            includeArguments(additionalArguments)
        ];

        const code:Number = await octo.map(x => x.launchOcto(configure))
            .getOrElseL((x) => { throw new Error(x); });

        tasks.setResult(tasks.TaskResult.Succeeded, "Succeeded with code " + code);
    }catch(err){
        tasks.error(err);
        tasks.setResult(tasks.TaskResult.Failed, "Failed to push package. " + err.message);
    }
}
开发者ID:OctopusDeploy,项目名称:OctoTFS,代码行数:29,代码来源:index.ts

示例7: run

export async function run(nuGetPath: string): Promise<void> {
    nutil.setConsoleCodePage();

    let buildIdentityDisplayName: string = null;
    let buildIdentityAccount: string = null;

    let args: string = tl.getInput("arguments", false);

    const version = await peParser.getFileVersionInfoAsync(nuGetPath);
    if(version.productVersion.a < 3 || (version.productVersion.a <= 3 && version.productVersion.b < 5))
    {
        tl.setResult(tl.TaskResult.Failed, tl.loc("Info_NuGetSupportedAfter3_5", version.strings.ProductVersion));
        return;
    }

    try {
        let credProviderPath = nutil.locateCredentialProvider();

        // Clauses ordered in this way to avoid short-circuit evaluation, so the debug info printed by the functions
        // is unconditionally displayed
        const quirks = await ngToolRunner.getNuGetQuirksAsync(nuGetPath);
        const useCredProvider = ngToolRunner.isCredentialProviderEnabled(quirks) && credProviderPath;
        // useCredConfig not placed here: This task will only support NuGet versions >= 3.5.0 which support credProvider both hosted and OnPrem

        let accessToken = auth.getSystemAccessToken();
        let serviceUri = tl.getEndpointUrl("SYSTEMVSSCONNECTION", false);
        let urlPrefixes = await locationHelpers.assumeNuGetUriPrefixes(serviceUri);
        tl.debug(`Discovered URL prefixes: ${urlPrefixes}`);

        // Note to readers: This variable will be going away once we have a fix for the location service for
        // customers behind proxies
        let testPrefixes = tl.getVariable("NuGetTasks.ExtraUrlPrefixesForTesting");
        if (testPrefixes) {
            urlPrefixes = urlPrefixes.concat(testPrefixes.split(";"));
            tl.debug(`All URL prefixes: ${urlPrefixes}`);
        }
        let authInfo = new auth.NuGetExtendedAuthInfo(new auth.InternalAuthInfo(urlPrefixes, accessToken, useCredProvider, false), []);
        let environmentSettings: ngToolRunner.NuGetEnvironmentSettings = {
            credProviderFolder: useCredProvider ? path.dirname(credProviderPath) : null,
            extensionsDisabled: true
        };

        let executionOptions = new NuGetExecutionOptions(
            nuGetPath,
            environmentSettings,
            args,
            authInfo);

        runNuGet(executionOptions);
    } catch (err) {
        tl.error(err);

        if (buildIdentityDisplayName || buildIdentityAccount) {
            tl.warning(tl.loc("BuildIdentityPermissionsHint", buildIdentityDisplayName, buildIdentityAccount));
        }

        tl.setResult(tl.TaskResult.Failed, "");
    }
}
开发者ID:bleissem,项目名称:vsts-tasks,代码行数:59,代码来源:nugetcustom.ts

示例8: tryDeleteFile

function tryDeleteFile(filePath: string): void {
    if (fs.existsSync(filePath)) {
        try {
            fs.unlinkSync(filePath);
        } catch (err) {
            tl.error(err.message);
        }
    }
}
开发者ID:Microsoft,项目名称:vsts-tasks,代码行数:9,代码来源:ssh.ts

示例9: setKubeConfigEnvVariable

 public setKubeConfigEnvVariable() {
     if (this.kubeconfigFile && fs.existsSync(this.kubeconfigFile)) {
         tl.setVariable("KUBECONFIG", this.kubeconfigFile);
     }
     else {
         tl.error(tl.loc('KubernetesServiceConnectionNotFound'));
         throw new Error(tl.loc('KubernetesServiceConnectionNotFound'));
     }
 }
开发者ID:grawcho,项目名称:vso-agent-tasks,代码行数:9,代码来源:clusterconnection.ts

示例10: setDockerConfigEnvVariable

 public setDockerConfigEnvVariable() {
     if (this.configurationDirPath && fs.existsSync(this.configurationDirPath)) {
         tl.setVariable("DOCKER_CONFIG", this.configurationDirPath, true);
     }
     else {
         tl.error(tl.loc('DockerRegistryNotFound'));
         throw new Error(tl.loc('DockerRegistryNotFound'));
     }
 }
开发者ID:shubham90,项目名称:vsts-tasks,代码行数:9,代码来源:containerconnection.ts


注:本文中的vsts-task-lib/task.error函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。