Skip to content

Commit d831e81

Browse files
Install-DbaSqlWatch: Add missing EnableException (#10353)
1 parent 965482e commit d831e81

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

public/Install-DbaSqlWatch.ps1

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -170,9 +170,8 @@ function Install-DbaSqlWatch {
170170
}
171171

172172
Write-ProgressHelper -StepNumber ($stepCounter++) -Message "Publishing SqlWatch dacpac to $database on $instance" -TotalSteps $totalSteps
173-
$DacProfile = New-DbaDacProfile -SqlInstance $server -Database $Database -Path $localCachedCopy -PublishOptions $PublishOptions | Select-Object -ExpandProperty FileName
174-
$PublishResults = Publish-DbaDacPackage -SqlInstance $server -Database $Database -Path $DacPacPath -PublishXml $DacProfile
175-
Remove-Item -Path $DacProfile
173+
$DacProfile = New-DbaDacProfile -SqlInstance $server -Database $Database -Path $localCachedCopy -PublishOptions $PublishOptions -EnableException | Select-Object -ExpandProperty FileName
174+
$PublishResults = Publish-DbaDacPackage -SqlInstance $server -Database $Database -Path $DacPacPath -PublishXml $DacProfile -EnableException
176175

177176
# parse results
178177
$parens = Select-String -InputObject $PublishResults.Result -Pattern "\(([^\)]+)\)" -AllMatches
@@ -190,6 +189,8 @@ function Install-DbaSqlWatch {
190189
}
191190
} catch {
192191
Stop-Function -Message "DACPAC failed to publish to $database on $instance." -ErrorRecord $_ -Target $instance -Continue
192+
} finally {
193+
Remove-Item -Path $DacProfile -ErrorAction SilentlyContinue
193194
}
194195

195196
Write-Message -Level Verbose -Message "Finished installing/updating SqlWatch in $database on $instance."

0 commit comments

Comments
 (0)