Merge pull request #127 from Icinga:fix/mssql_connection_error_handling

Fixes MSSQL error handling on Integrated Security

Fixes wrong error message on failed MSSQL connection due to database not reachable by using `-IntegratedSecurity`
This commit is contained in:
Lord Hepipud 2020-09-15 15:42:21 +02:00 committed by GitHub
commit 26e335ee8a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 5 deletions

View file

@ -11,6 +11,10 @@ Released closed milestones can be found on [GitHub](https://github.com/Icinga/ic
[Issue and PRs](https://github.com/Icinga/icinga-powershell-framework/milestone/10?closed=1) [Issue and PRs](https://github.com/Icinga/icinga-powershell-framework/milestone/10?closed=1)
### Bugfixes
* [#127](https://github.com/Icinga/icinga-powershell-framework/issues/127) Fixes wrong error message on failed MSSQL connection due to database not reachable by using `-IntegratedSecurity`
## 1.2.0 (2020-08-28) ## 1.2.0 (2020-08-28)
[Issue and PRs](https://github.com/Icinga/icinga-powershell-framework/milestone/7?closed=1) [Issue and PRs](https://github.com/Icinga/icinga-powershell-framework/milestone/7?closed=1)

View file

@ -89,11 +89,13 @@ function Open-IcingaMSSQLConnection()
return $null; return $null;
} }
if ([string]::IsNullOrEmpty($Username) -eq $FALSE) {
Exit-IcingaThrowException ` Exit-IcingaThrowException `
-InputString $_.Exception.Message ` -InputString $_.Exception.Message `
-StringPattern $Username ` -StringPattern $Username `
-ExceptionType 'Input' ` -ExceptionType 'Input' `
-ExceptionThrown $IcingaExceptions.Inputs.MSSQLCredentialHandling; -ExceptionThrown $IcingaExceptions.Inputs.MSSQLCredentialHandling;
}
Exit-IcingaThrowException ` Exit-IcingaThrowException `
-InputString $_.Exception.Message ` -InputString $_.Exception.Message `