mirror of
https://github.com/Nikolay-Shirokov/cc-1c-skills.git
synced 2026-08-13 15:03:20 +03:00
fix(mxl-compile): писать ошибки в stderr напрямую, а не через Write-Error
Write-Error оборачивает сообщение в ErrorRecord: приписывает имя скрипта, добавляет хвост CategoryInfo и ломает текст по ширине окна консоли. Длинные сообщения приезжали разорванными посреди слова, и по ним нельзя было ни искать подстроку, ни читать их глазами. Остальные четырнадцать мест в файле уже писали через Console.Error — приведены оставшиеся шесть. Тексты сообщений не менялись. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
3bb717b2cc
commit
3e7e105c43
@@ -185,7 +185,7 @@ $script:formatVersion = Detect-FormatVersion ([System.IO.Path]::GetDirectoryName
|
||||
# --- 1. Load and validate JSON ---
|
||||
|
||||
if (-not (Test-Path $JsonPath)) {
|
||||
Write-Error "File not found: $JsonPath"
|
||||
[Console]::Error.WriteLine("File not found: $JsonPath")
|
||||
exit 1
|
||||
}
|
||||
|
||||
@@ -197,11 +197,11 @@ $def = $json | ConvertFrom-Json
|
||||
# список областей встречается у макета без строк. Прежняя проверка `-not` объявляла и то
|
||||
# и другое отсутствующим.
|
||||
if (-not $def.PSObject.Properties['columns'] -or $null -eq $def.columns) {
|
||||
Write-Error "Required field 'columns' is missing"
|
||||
[Console]::Error.WriteLine("Required field 'columns' is missing")
|
||||
exit 1
|
||||
}
|
||||
if (-not $def.PSObject.Properties['areas'] -or $null -eq $def.areas) {
|
||||
Write-Error "Required field 'areas' is missing"
|
||||
[Console]::Error.WriteLine("Required field 'areas' is missing")
|
||||
exit 1
|
||||
}
|
||||
|
||||
@@ -963,14 +963,14 @@ foreach ($area in $def.areas) {
|
||||
$cursor++
|
||||
}
|
||||
if (($cursor + $colSpan - 1) -gt $areaColumns) {
|
||||
Write-Error "Row exceeds 'columns' ($areaColumns): area `"$areaName`", row $($localRow + 1)"
|
||||
[Console]::Error.WriteLine("Row exceeds 'columns' ($areaColumns): area `"$areaName`", row $($localRow + 1)")
|
||||
exit 1
|
||||
}
|
||||
$cell | Add-Member -NotePropertyName col -NotePropertyValue $cursor -Force
|
||||
$cursor += $colSpan
|
||||
}
|
||||
} elseif ($positioned.Count -ne $row.cells.Count) {
|
||||
Write-Error "Cell without 'col' mixed with positioned cells: area `"$areaName`", row $($localRow + 1)"
|
||||
[Console]::Error.WriteLine("Cell without 'col' mixed with positioned cells: area `"$areaName`", row $($localRow + 1)")
|
||||
exit 1
|
||||
}
|
||||
|
||||
@@ -981,7 +981,7 @@ foreach ($area in $def.areas) {
|
||||
$cellIdx++
|
||||
$colParsed = 0
|
||||
if (-not [int]::TryParse("$($cell.col)", [ref]$colParsed) -or $colParsed -lt 1 -or $colParsed -gt $areaColumns) {
|
||||
Write-Error "Invalid 'col' value `"$($cell.col)`": area `"$areaName`", row $($localRow + 1), cell $cellIdx"
|
||||
[Console]::Error.WriteLine("Invalid 'col' value `"$($cell.col)`": area `"$areaName`", row $($localRow + 1), cell $cellIdx")
|
||||
exit 1
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user