Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for the optional 'source' property to the error/warning functions #1009

Merged
merged 7 commits into from
Jan 16, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions node/internal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -282,12 +282,12 @@ export function _command(command: string, properties: any, message: string) {
_writeLine(taskCmd.toString());
}

export function _warning(message: string): void {
_command('task.issue', { 'type': 'warning' }, message);
export function _warning(message: string, source?: string): void {
_command('task.issue', { 'type': 'warning', 'source': source }, message);
}

export function _error(message: string): void {
_command('task.issue', { 'type': 'error' }, message);
export function _error(message: string, source?: string): void {
DenisNikulin5 marked this conversation as resolved.
Show resolved Hide resolved
_command('task.issue', { 'type': 'error', 'source': source }, message);
}

export function _debug(message: string): void {
Expand Down
2 changes: 1 addition & 1 deletion node/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion node/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "azure-pipelines-task-lib",
"version": "4.7.0",
"version": "4.8.0",
"description": "Azure Pipelines Task SDK",
"main": "./task.js",
"typings": "./task.d.ts",
Expand Down
10 changes: 7 additions & 3 deletions powershell/VstsTaskSdk/LoggingCommandFunctions.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,8 @@ function Write-TaskError {
[string]$SourcePath,
[string]$LineNumber,
[string]$ColumnNumber,
[switch]$AsOutput)
[switch]$AsOutput,
[string]$IssueSource)

Write-LogIssue -Type error @PSBoundParameters
}
Expand Down Expand Up @@ -322,7 +323,8 @@ function Write-TaskWarning {
[string]$SourcePath,
[string]$LineNumber,
[string]$ColumnNumber,
[switch]$AsOutput)
[switch]$AsOutput,
[string]$IssueSource)

Write-LogIssue -Type warning @PSBoundParameters
}
Expand Down Expand Up @@ -544,14 +546,16 @@ function Write-LogIssue {
[string]$SourcePath,
[string]$LineNumber,
[string]$ColumnNumber,
[switch]$AsOutput)
[switch]$AsOutput,
[string]$IssueSource)

$command = Format-LoggingCommand -Area 'task' -Event 'logissue' -Data $Message -Properties @{
'type' = $Type
'code' = $ErrCode
'sourcepath' = $SourcePath
'linenumber' = $LineNumber
'columnnumber' = $ColumnNumber
'source' = $IssueSource
}
if ($AsOutput) {
return $command
Expand Down
3 changes: 2 additions & 1 deletion powershell/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion powershell/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "0.17.0",
"version": "0.18.0",
"private": true,
"scripts": {
"build": "node make.js build",
Expand Down