From e37a44dd878ac25fe9e2f53aae54379902e3ae64 Mon Sep 17 00:00:00 2001 From: Mikael Karlsson <43226266+Micke-K@users.noreply.github.com> Date: Thu, 13 Nov 2025 20:24:03 +1100 Subject: [PATCH] 3.10.1.7 Issue 375 - Additional error handling in the Word output provider. --- Extensions/DocumentationWord.psm1 | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/Extensions/DocumentationWord.psm1 b/Extensions/DocumentationWord.psm1 index c50ce07..8323270 100644 --- a/Extensions/DocumentationWord.psm1 +++ b/Extensions/DocumentationWord.psm1 @@ -409,10 +409,31 @@ function Invoke-WordPostProcessItems catch {} #update fields, ToC etc. - $script:doc.Fields | ForEach-Object -Process { $_.Update() | Out-Null } - $script:doc.TablesOfContents | ForEach-Object -Process { $_.Update() | Out-Null } - $script:doc.TablesOfFigures | ForEach-Object -Process { $_.Update() | Out-Null } - $script:doc.TablesOfAuthorities | ForEach-Object -Process { $_.Update() | Out-Null } + try { + $script:doc.Fields | ForEach-Object -Process { $_.Update() | Out-Null } + } + catch { + Write-LogError "Failed to update document fields" $_.Exception + } + try { + $script:doc.TablesOfContents | ForEach-Object -Process { $_.Update() | Out-Null } + } + catch { + Write-LogError "Failed to update Table of Contents" $_.Exception + } + try { + $script:doc.TablesOfFigures | ForEach-Object -Process { $_.Update() | Out-Null } + } + catch { + Write-LogError "Failed to update Table of Figures" $_.Exception + } + try { + $script:doc.TablesOfAuthorities | ForEach-Object -Process { $_.Update() | Out-Null } + } + catch { + Write-LogError "Failed to update Table of Authorities" $_.Exception + } + Write-Log "Using document format: $($global:cbWordDocumentationFormat.SelectedValue)" try {