Throw exception on connection failure to be captured by frontend (#2190)

This commit is contained in:
Cheena Malhotra
2023-08-23 18:28:47 -07:00
committed by GitHub
parent 2502e23f43
commit 4e5a7ebe97
7 changed files with 182 additions and 177 deletions

View File

@@ -1878,6 +1878,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Connection
/// <param name="connInfo">The connection info to connect with</param>
/// <param name="featureName">A plaintext string that will be included in the application name for the connection</param>
/// <returns>A SqlConnection created with the given connection info</returns>
/// <exception cref="Exception">When an error occurs.</exception>
public static SqlConnection OpenSqlConnection(ConnectionInfo connInfo, string featureName = null)
{
try
@@ -1927,9 +1928,8 @@ namespace Microsoft.SqlTools.ServiceLayer.Connection
"Failed opening a SqlConnection: error:{0} inner:{1} stacktrace:{2}",
ex.Message, ex.InnerException != null ? ex.InnerException.Message : string.Empty, ex.StackTrace);
Logger.Error(error);
throw;
}
return null;
}
/// <summary>