Skip to content

Commit

Permalink
Update error handling in Connect-SQLAnalysis
Browse files Browse the repository at this point in the history
  • Loading branch information
johlju committed Jan 27, 2019
1 parent 49e13d9 commit 2f0f2d1
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions SqlServerDscHelper.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -174,13 +174,16 @@ function Connect-SQLAnalysis
{
$analysisServicesObject.Connect($analysisServicesDataSource)
}
else

if ((-not $analysisServicesObject) -or ($analysisServicesObject -and $analysisServicesObject.Connected -eq $false))
{
$errorMessage = $script:localizedData.FailedToConnectToAnalysisServicesInstance -f $analysisServiceInstance
New-InvalidOperationException -Message $errorMessage
}

Write-Verbose -Message ($script:localizedData.ConnectedToAnalysisServicesInstance -f $analysisServiceInstance) -Verbose
else
{
Write-Verbose -Message ($script:localizedData.ConnectedToAnalysisServicesInstance -f $analysisServiceInstance) -Verbose
}
}
catch
{
Expand Down Expand Up @@ -1572,7 +1575,7 @@ function Get-ServiceAccount
function Find-ExceptionByNumber
{
# Define parameters
param
param
(
[Parameter(Mandatory = $true)]
[System.Exception]
Expand Down

0 comments on commit 2f0f2d1

Please sign in to comment.