Surface errors when writing to file

This commit is contained in:
Jeffrey
2026-08-12 17:31:50 +02:00
parent b21be418cd
commit dd929f8eec
2 changed files with 15 additions and 1 deletions
+2 -1
View File
@@ -27,10 +27,11 @@ function Save-ToFile {
)
try {
$Config | ConvertTo-Json -Depth $MaxDepth | Set-Content -Path $FilePath -Encoding UTF8
$Config | ConvertTo-Json -Depth $MaxDepth | Set-Content -Path $FilePath -Encoding UTF8 -ErrorAction Stop
return $true
}
catch {
Write-Error "Failed to write '$FilePath': $($_.Exception.Message)"
return $false
}
}