mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-02-09 09:42:35 -05:00
This reverts commit 306b43b8b7.
This commit is contained in:
@@ -22,6 +22,7 @@ using Microsoft.SqlTools.ServiceLayer.LanguageServices.Contracts;
|
|||||||
using Microsoft.SqlTools.ServiceLayer.Utility;
|
using Microsoft.SqlTools.ServiceLayer.Utility;
|
||||||
using Microsoft.SqlTools.Utility;
|
using Microsoft.SqlTools.Utility;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
|
||||||
namespace Microsoft.SqlTools.ServiceLayer.Connection
|
namespace Microsoft.SqlTools.ServiceLayer.Connection
|
||||||
{
|
{
|
||||||
@@ -37,12 +38,6 @@ namespace Microsoft.SqlTools.ServiceLayer.Connection
|
|||||||
|
|
||||||
public const int MaxServerlessReconnectTries = 5; // Max number of tries to wait for a serverless database to start up when its paused before giving up.
|
public const int MaxServerlessReconnectTries = 5; // Max number of tries to wait for a serverless database to start up when its paused before giving up.
|
||||||
|
|
||||||
// SQL Error Code Constants
|
|
||||||
// Referenced from: https://learn.microsoft.com/en-us/sql/relational-databases/errors-events/database-engine-events-and-errors?view=sql-server-ver16
|
|
||||||
private const int DoesNotMeetPWReqs = 18466; // Password does not meet complexity requirements.
|
|
||||||
private const int PWCannotBeUsed = 18463; // Password cannot be used at this time.
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Singleton service instance
|
/// Singleton service instance
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -1164,25 +1159,18 @@ namespace Microsoft.SqlTools.ServiceLayer.Connection
|
|||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
newResponse.Result = false;
|
newResponse.Result = false;
|
||||||
newResponse.ErrorMessage = ex.Message;
|
newResponse.ErrorMessage = ex.InnerException != null ? (ex.Message + Environment.NewLine + Environment.NewLine + ex.InnerException.Message) : ex.Message;
|
||||||
int errorCode = 0;
|
newResponse.ErrorMessage = Regex.Replace(newResponse.ErrorMessage, @"\r?\nChanged database context to '\w+'\.", "");
|
||||||
|
newResponse.ErrorMessage = Regex.Replace(newResponse.ErrorMessage, @"\r?\nChanged language setting to \w+\.", "");
|
||||||
if ((ex.InnerException as SqlException) != null && (ex.InnerException as SqlException)?.Errors.Count != 0)
|
if (newResponse.ErrorMessage.Equals(SR.PasswordChangeEmptyPassword))
|
||||||
{
|
|
||||||
SqlError endError = (ex.InnerException as SqlException).Errors[0];
|
|
||||||
newResponse.ErrorMessage = endError.Message;
|
|
||||||
errorCode = endError.Number;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (errorCode == 0 && newResponse.ErrorMessage.Equals(SR.PasswordChangeEmptyPassword))
|
|
||||||
{
|
{
|
||||||
newResponse.ErrorMessage += Environment.NewLine + Environment.NewLine + SR.PasswordChangeEmptyPasswordRetry;
|
newResponse.ErrorMessage += Environment.NewLine + Environment.NewLine + SR.PasswordChangeEmptyPasswordRetry;
|
||||||
}
|
}
|
||||||
else if (errorCode == DoesNotMeetPWReqs)
|
else if (newResponse.ErrorMessage.Contains(SR.PasswordChangeDNMReqs))
|
||||||
{
|
{
|
||||||
newResponse.ErrorMessage += Environment.NewLine + Environment.NewLine + SR.PasswordChangeDNMReqsRetry;
|
newResponse.ErrorMessage += Environment.NewLine + Environment.NewLine + SR.PasswordChangeDNMReqsRetry;
|
||||||
}
|
}
|
||||||
else if (errorCode == PWCannotBeUsed)
|
else if (newResponse.ErrorMessage.Contains(SR.PasswordChangePWCannotBeUsed))
|
||||||
{
|
{
|
||||||
newResponse.ErrorMessage += Environment.NewLine + Environment.NewLine + SR.PasswordChangePWCannotBeUsedRetry;
|
newResponse.ErrorMessage += Environment.NewLine + Environment.NewLine + SR.PasswordChangePWCannotBeUsedRetry;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -77,6 +77,14 @@ namespace Microsoft.SqlTools.ServiceLayer
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static string PasswordChangeDNMReqs
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return Keys.GetString(Keys.PasswordChangeDNMReqs);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static string PasswordChangeDNMReqsRetry
|
public static string PasswordChangeDNMReqsRetry
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@@ -85,6 +93,14 @@ namespace Microsoft.SqlTools.ServiceLayer
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static string PasswordChangePWCannotBeUsed
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return Keys.GetString(Keys.PasswordChangePWCannotBeUsed);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static string PasswordChangePWCannotBeUsedRetry
|
public static string PasswordChangePWCannotBeUsedRetry
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@@ -10120,9 +10136,15 @@ namespace Microsoft.SqlTools.ServiceLayer
|
|||||||
public const string PasswordChangeEmptyPasswordRetry = "PasswordChangeEmptyPasswordRetry";
|
public const string PasswordChangeEmptyPasswordRetry = "PasswordChangeEmptyPasswordRetry";
|
||||||
|
|
||||||
|
|
||||||
|
public const string PasswordChangeDNMReqs = "PasswordChangeDNMReqs";
|
||||||
|
|
||||||
|
|
||||||
public const string PasswordChangeDNMReqsRetry = "PasswordChangeDNMReqsRetry";
|
public const string PasswordChangeDNMReqsRetry = "PasswordChangeDNMReqsRetry";
|
||||||
|
|
||||||
|
|
||||||
|
public const string PasswordChangePWCannotBeUsed = "PasswordChangePWCannotBeUsed";
|
||||||
|
|
||||||
|
|
||||||
public const string PasswordChangePWCannotBeUsedRetry = "PasswordChangePWCannotBeUsedRetry";
|
public const string PasswordChangePWCannotBeUsedRetry = "PasswordChangePWCannotBeUsedRetry";
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -176,10 +176,18 @@
|
|||||||
<value>Press OK to input a new password that is not empty.</value>
|
<value>Press OK to input a new password that is not empty.</value>
|
||||||
<comment></comment>
|
<comment></comment>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="PasswordChangeDNMReqs" xml:space="preserve">
|
||||||
|
<value>password does not meet operating system policy requirements</value>
|
||||||
|
<comment></comment>
|
||||||
|
</data>
|
||||||
<data name="PasswordChangeDNMReqsRetry" xml:space="preserve">
|
<data name="PasswordChangeDNMReqsRetry" xml:space="preserve">
|
||||||
<value>Press OK to input a new password that meets operating system policy requirements.</value>
|
<value>Press OK to input a new password that meets operating system policy requirements.</value>
|
||||||
<comment></comment>
|
<comment></comment>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="PasswordChangePWCannotBeUsed" xml:space="preserve">
|
||||||
|
<value>password cannot be used at this time</value>
|
||||||
|
<comment></comment>
|
||||||
|
</data>
|
||||||
<data name="PasswordChangePWCannotBeUsedRetry" xml:space="preserve">
|
<data name="PasswordChangePWCannotBeUsedRetry" xml:space="preserve">
|
||||||
<value>Press OK to input a different password.</value>
|
<value>Press OK to input a different password.</value>
|
||||||
<comment></comment>
|
<comment></comment>
|
||||||
|
|||||||
@@ -51,8 +51,12 @@ PasswordChangeEmptyPassword = New password cannot be empty
|
|||||||
|
|
||||||
PasswordChangeEmptyPasswordRetry = Press OK to input a new password that is not empty.
|
PasswordChangeEmptyPasswordRetry = Press OK to input a new password that is not empty.
|
||||||
|
|
||||||
|
PasswordChangeDNMReqs = password does not meet operating system policy requirements
|
||||||
|
|
||||||
PasswordChangeDNMReqsRetry = Press OK to input a new password that meets operating system policy requirements.
|
PasswordChangeDNMReqsRetry = Press OK to input a new password that meets operating system policy requirements.
|
||||||
|
|
||||||
|
PasswordChangePWCannotBeUsed = password cannot be used at this time
|
||||||
|
|
||||||
PasswordChangePWCannotBeUsedRetry = Press OK to input a different password.
|
PasswordChangePWCannotBeUsedRetry = Press OK to input a different password.
|
||||||
|
|
||||||
### Connection Params Validation Errors
|
### Connection Params Validation Errors
|
||||||
|
|||||||
@@ -6515,11 +6515,21 @@ The Query Processor estimates that implementing the following index could improv
|
|||||||
<target state="new">Press OK to input a new password that is not empty.</target>
|
<target state="new">Press OK to input a new password that is not empty.</target>
|
||||||
<note></note>
|
<note></note>
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
|
<trans-unit id="PasswordChangeDNMReqs">
|
||||||
|
<source>password does not meet operating system policy requirements</source>
|
||||||
|
<target state="new">password does not meet operating system policy requirements</target>
|
||||||
|
<note></note>
|
||||||
|
</trans-unit>
|
||||||
<trans-unit id="PasswordChangeDNMReqsRetry">
|
<trans-unit id="PasswordChangeDNMReqsRetry">
|
||||||
<source>Press OK to input a new password that meets operating system policy requirements.</source>
|
<source>Press OK to input a new password that meets operating system policy requirements.</source>
|
||||||
<target state="new">Press OK to input a new password that meets operating system policy requirements.</target>
|
<target state="new">Press OK to input a new password that meets operating system policy requirements.</target>
|
||||||
<note></note>
|
<note></note>
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
|
<trans-unit id="PasswordChangePWCannotBeUsed">
|
||||||
|
<source>password cannot be used at this time</source>
|
||||||
|
<target state="new">password cannot be used at this time</target>
|
||||||
|
<note></note>
|
||||||
|
</trans-unit>
|
||||||
<trans-unit id="PasswordChangePWCannotBeUsedRetry">
|
<trans-unit id="PasswordChangePWCannotBeUsedRetry">
|
||||||
<source>Press OK to input a different password.</source>
|
<source>Press OK to input a different password.</source>
|
||||||
<target state="new">Press OK to input a different password.</target>
|
<target state="new">Press OK to input a different password.</target>
|
||||||
|
|||||||
Reference in New Issue
Block a user