Skip to content

Commit

Permalink
Added Stop-Function calls to fix #5050
Browse files Browse the repository at this point in the history
  • Loading branch information
spaghettidba committed Feb 5, 2019
1 parent ab8f056 commit 02faaa4
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions functions/ConvertTo-DbaDataTable.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -374,10 +374,18 @@ function ConvertTo-DbaDataTable {

$datarow.Item($property.Name) = $newColumn.Value
} catch {
Write-Message -Level Warning -Message "Failed to add property $($property.Name) from $object" -ErrorRecord $_ -Target $object
if ($EnableException) {
Stop-Function -Message "Failed to add property $($property.Name) from $object" -ErrorRecord $_ -Target $object
} else {
Write-Message -Level $levl -Message "Failed to add property $($property.Name) from $object" -ErrorRecord $_ -Target $object
}
}
} else {
Write-Message -Level Warning -Message "Failed to add property $($property.Name) from $object" -ErrorRecord $_ -Target $object
if ($EnableException) {
Stop-Function -Message "Failed to add property $($property.Name) from $object" -ErrorRecord $_ -Target $object
} else {
Write-Message -Level $levl -Message "Failed to add property $($property.Name) from $object" -ErrorRecord $_ -Target $object
}
}
}
}
Expand Down

0 comments on commit 02faaa4

Please sign in to comment.