Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Explicitly specify ErrorRecord to use in DetailedView error format script#25627

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
MatejKafka wants to merge2 commits intoPowerShell:master
base:master
Choose a base branch
Loading
fromMatejKafka:detailed-view-format
Open
Show file tree
Hide file tree
Changes fromall 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
Original file line numberDiff line numberDiff line change
Expand Up@@ -1324,7 +1324,7 @@ function Get-ConciseViewPositionMessage {
}

if ($ErrorView -eq 'DetailedView') {
$message = Get-Error | Out-String
$message = Get-Error$err| Out-String
return "${errorColor}${message}${resetcolor}"
}

Expand Down
9 changes: 9 additions & 0 deletionstest/powershell/engine/Formatting/ErrorView.Tests.ps1
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -211,5 +211,14 @@ Describe 'Tests for $ErrorView' -Tag CI {

$e | Should -BeExactly (Get-Error | Out-String).Trim([Environment]::NewLine.ToCharArray())
}

It 'Renders the passed error instead of the last one' {
# PR #25627
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Suggested change
# PR #25627

Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Why remove the comment? It is useful to get more context as to why such a weird behavior is even tested.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

We never add such comments.

$ErrorView = 'DetailedView'
$first = try {throw "first"} catch {$_}
try {throw "second"} catch {}
# DetailedView internally calls 'Get-Error' to render the output, ensure that it picks up the correct error
$first | Out-String | Should -BeLike '*throw "first"*'
}
}
}

[8]ページ先頭

©2009-2025 Movatter.jp