Skip to content

Commit

Permalink
removed catching specific types of exception and just made it general
Browse files Browse the repository at this point in the history
  • Loading branch information
RichieBzzzt committed Jun 22, 2018
1 parent 1ff5f63 commit be95765
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions PoshSSDTBuildDeploy/Functions/PublishDatabaseDeployment.ps1
Expand Up @@ -74,15 +74,13 @@ Function Publish-DatabaseDeployment {
Write-Host "Deployment successful!" -ForegroundColor DarkGreen Write-Host "Deployment successful!" -ForegroundColor DarkGreen
} }
} }
catch [Microsoft.SqlServer.Dac.DacServicesException] { catch {

$toThrow = ("Deployment failed: '{0}'" -f $_.Exception)
$toThrow = ("Deployment failed: '{0}' Reason: '{1}'" -f $_.Exception.Message, $_.Exception.InnerException.Message)
} }
finally { finally {
Unregister-Event -SourceIdentifier "msg" Unregister-Event -SourceIdentifier "msg"
if ($toThrow) { if ($ToThrow) {
$error[0]|format-list -force Throw $ToThrow
Throw $toThrow
} }
if ($GenerateDeploymentReport -eq $true) { if ($GenerateDeploymentReport -eq $true) {
$result.DeploymentReport | Out-File $DeploymentReport $result.DeploymentReport | Out-File $DeploymentReport
Expand Down

0 comments on commit be95765

Please sign in to comment.