From 990c9eb249c35a8e3b2e252fd66be252aa2918a5 Mon Sep 17 00:00:00 2001 From: Yorick Barbanneau Date: Wed, 20 Jan 2021 17:35:45 +0100 Subject: [PATCH] Update error and debug actions --- backup.ps1 | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/backup.ps1 b/backup.ps1 index 209ae81..3fcd3ae 100644 --- a/backup.ps1 +++ b/backup.ps1 @@ -13,7 +13,8 @@ $global:logfile = $false $tmp_path = "$PSScriptRoot\tmp" $global:bin_path = "$PSScriptRoot\bin" $ProgressPreference = "SilentlyContinue" -$ErrorActionPreference = "SilentlyContinue" +$ErrorActionPreference = "Stop" +$DebugPreference = "SilentlyContinue" if ( $debug ) { $DebugPreference = "Continue" @@ -36,6 +37,7 @@ function json_to_hash () { Write-Debug "Found value $_" $r[$_.Name] = $_.Value } + Write-debug "End json_to_hash" return $r } @@ -197,8 +199,9 @@ $backup.actions | % { } try { - Import-Module -Name "$PSScriptRoot\lib\backupscript-$($_.type).psm1" -Force - Backup-Create -source $source -dest $destination -name $_.name -opt $opt #-EA Stop + Write-Debug "Import module $($_.type)" + Import-Module -Name "$PSScriptRoot\lib\backupscript-$($_.type).psm1" + Backup-Create -source $source -dest $destination -name $_.name -opt $opt if ( $_.psobject.properties.match('hook_postexec').Count -and $_.hook_postexec -ne "" ) { Set-Message "Postexec hook : execute $($_.hook_postexec)" Invoke-Expression $_.hook_postexec