Skip to content

Commit

Permalink
Try stop errors breaking example rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
ShaunLawrie committed Mar 15, 2024
1 parent 702108f commit d83be5b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
7 changes: 0 additions & 7 deletions PwshSpectreConsole.Docs/src/powershell/Mocks.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,4 @@ function Stop-SpectreRecordingMock {
$result += '<span>Hello</span><span> </span><span style="color: #FF0000">world</span>' + "`n"
$result += '</pre>'
return $result
}

function Write-ErrorMock {
param (
[string] $Message
)
Write-SpectreHost "[red]$Message[/]"
}
8 changes: 7 additions & 1 deletion PwshSpectreConsole.Docs/src/powershell/UpdateDocs.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,13 @@ foreach ($doc in $docs) {
}
Write-Host "Modified sample:"
Write-Host -ForegroundColor DarkGray $code
Invoke-Expression $code
if($code -like "*Write-Error*") {
$ErrorActionPreference = "SilentlyContinue"
Invoke-Expression $code
$ErrorActionPreference = "Stop"
} else {
Invoke-Expression $code
}
$recording = Stop-SpectreRecording -Title "Example $([int]$example++)"

$castName = ($doc.Name -replace '.md$', '' -replace '-', '').ToLower() + "Example$example"
Expand Down

0 comments on commit d83be5b

Please sign in to comment.