microsoft / vsts-nexus

VSTS Build Extension for integration with Sonatype Nexus
MIT License
12 stars 17 forks source link

Success if upload fails #2

Closed davidstaheli closed 8 years ago

davidstaheli commented 8 years ago

In this code, it appears the task will succeed if the upload fails. The error handling block should return instead of continuing execution.

request.post({ url: nexusUploadUrl, formData: formData }, function optionalCallback(err, httpResponse, body) {
    if (err) {
        tl.setResult(tl.TaskResult.Failed, err);
    }
    tl.debug('Upload successful, server responded with: ' + body);
    tl.setResult(tl.TaskResult.Succeeded, 'Successfully uploaded ' + fileName);
}).auth(username, password, true);
jasholl commented 8 years ago

setting the result to failed will fail the task; peeking in the code, the process is actually killed when a task fails. Here's the doc on the setting the result: "If the result is Failed (1), then execution will halt."