Update error and debug actions

This commit is contained in:
Yorick Barbanneau 2021-01-20 17:35:45 +01:00
parent 1397b77f49
commit 990c9eb249

View file

@ -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