mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-02-16 10:58:30 -05:00
Made connection errors more user-friendly (#57)
This commit is contained in:
@@ -162,8 +162,16 @@ namespace Microsoft.SqlTools.ServiceLayer.Connection
|
|||||||
connectionInfo.SqlConnection = connectionInfo.Factory.CreateSqlConnection(connectionString);
|
connectionInfo.SqlConnection = connectionInfo.Factory.CreateSqlConnection(connectionString);
|
||||||
connectionInfo.SqlConnection.Open();
|
connectionInfo.SqlConnection.Open();
|
||||||
}
|
}
|
||||||
catch(Exception ex)
|
catch (SqlException ex)
|
||||||
{
|
{
|
||||||
|
response.ErrorNumber = ex.Number;
|
||||||
|
response.ErrorMessage = ex.Message;
|
||||||
|
response.Messages = ex.ToString();
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
response.ErrorMessage = ex.Message;
|
||||||
response.Messages = ex.ToString();
|
response.Messages = ex.ToString();
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,10 +16,20 @@ namespace Microsoft.SqlTools.ServiceLayer.Connection.Contracts
|
|||||||
public string ConnectionId { get; set; }
|
public string ConnectionId { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets any connection error messages
|
/// Gets or sets any detailed connection error messages.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Messages { get; set; }
|
public string Messages { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Error message returned from the engine for a connection failure reason, if any.
|
||||||
|
/// </summary>
|
||||||
|
public string ErrorMessage { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Error number returned from the engine for connection failure reason, if any.
|
||||||
|
/// </summary>
|
||||||
|
public int ErrorNumber { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Information about the connected server.
|
/// Information about the connected server.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
Reference in New Issue
Block a user