mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-01-20 17:24:00 -05:00
Improve error message handling (#497)
- Add special handling for token expired errors so they send with a clear flag that'll allow clients to take action on this case - Send error message instead of callstack for all messages, and ensure all resource manager paths send back inner exceptions so users can understand the true root cause.
This commit is contained in:
@@ -27,7 +27,7 @@ namespace Microsoft.SqlTools.ResourceProvider.Core
|
||||
Keys.Culture = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static string NoSubscriptionsFound
|
||||
{
|
||||
@@ -35,7 +35,7 @@ namespace Microsoft.SqlTools.ResourceProvider.Core
|
||||
{
|
||||
return Keys.GetString(Keys.NoSubscriptionsFound);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static string AzureServerNotFound
|
||||
{
|
||||
@@ -43,7 +43,7 @@ namespace Microsoft.SqlTools.ResourceProvider.Core
|
||||
{
|
||||
return Keys.GetString(Keys.AzureServerNotFound);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static string AzureSubscriptionFailedErrorMessage
|
||||
{
|
||||
@@ -51,7 +51,7 @@ namespace Microsoft.SqlTools.ResourceProvider.Core
|
||||
{
|
||||
return Keys.GetString(Keys.AzureSubscriptionFailedErrorMessage);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static string DatabaseDiscoveryFailedErrorMessage
|
||||
{
|
||||
@@ -59,7 +59,7 @@ namespace Microsoft.SqlTools.ResourceProvider.Core
|
||||
{
|
||||
return Keys.GetString(Keys.DatabaseDiscoveryFailedErrorMessage);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static string FirewallRuleAccessForbidden
|
||||
{
|
||||
@@ -67,7 +67,7 @@ namespace Microsoft.SqlTools.ResourceProvider.Core
|
||||
{
|
||||
return Keys.GetString(Keys.FirewallRuleAccessForbidden);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static string FirewallRuleCreationFailed
|
||||
{
|
||||
@@ -75,7 +75,7 @@ namespace Microsoft.SqlTools.ResourceProvider.Core
|
||||
{
|
||||
return Keys.GetString(Keys.FirewallRuleCreationFailed);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static string FirewallRuleCreationFailedWithError
|
||||
{
|
||||
@@ -83,7 +83,7 @@ namespace Microsoft.SqlTools.ResourceProvider.Core
|
||||
{
|
||||
return Keys.GetString(Keys.FirewallRuleCreationFailedWithError);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static string InvalidIpAddress
|
||||
{
|
||||
@@ -91,7 +91,7 @@ namespace Microsoft.SqlTools.ResourceProvider.Core
|
||||
{
|
||||
return Keys.GetString(Keys.InvalidIpAddress);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static string InvalidServerTypeErrorMessage
|
||||
{
|
||||
@@ -99,7 +99,7 @@ namespace Microsoft.SqlTools.ResourceProvider.Core
|
||||
{
|
||||
return Keys.GetString(Keys.InvalidServerTypeErrorMessage);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static string LoadingExportableFailedGeneralErrorMessage
|
||||
{
|
||||
@@ -107,7 +107,7 @@ namespace Microsoft.SqlTools.ResourceProvider.Core
|
||||
{
|
||||
return Keys.GetString(Keys.LoadingExportableFailedGeneralErrorMessage);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static string FirewallRuleUnsupportedConnectionType
|
||||
{
|
||||
@@ -115,7 +115,7 @@ namespace Microsoft.SqlTools.ResourceProvider.Core
|
||||
{
|
||||
return Keys.GetString(Keys.FirewallRuleUnsupportedConnectionType);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
public class Keys
|
||||
@@ -123,40 +123,40 @@ namespace Microsoft.SqlTools.ResourceProvider.Core
|
||||
static ResourceManager resourceManager = new ResourceManager("Microsoft.SqlTools.ResourceProvider.Core.Localization.SR", typeof(SR).GetTypeInfo().Assembly);
|
||||
|
||||
static CultureInfo _culture = null;
|
||||
|
||||
|
||||
public const string NoSubscriptionsFound = "NoSubscriptionsFound";
|
||||
|
||||
|
||||
public const string AzureServerNotFound = "AzureServerNotFound";
|
||||
|
||||
|
||||
public const string AzureSubscriptionFailedErrorMessage = "AzureSubscriptionFailedErrorMessage";
|
||||
|
||||
|
||||
public const string DatabaseDiscoveryFailedErrorMessage = "DatabaseDiscoveryFailedErrorMessage";
|
||||
|
||||
|
||||
public const string FirewallRuleAccessForbidden = "FirewallRuleAccessForbidden";
|
||||
|
||||
|
||||
public const string FirewallRuleCreationFailed = "FirewallRuleCreationFailed";
|
||||
|
||||
|
||||
public const string FirewallRuleCreationFailedWithError = "FirewallRuleCreationFailedWithError";
|
||||
|
||||
|
||||
public const string InvalidIpAddress = "InvalidIpAddress";
|
||||
|
||||
|
||||
public const string InvalidServerTypeErrorMessage = "InvalidServerTypeErrorMessage";
|
||||
|
||||
|
||||
public const string LoadingExportableFailedGeneralErrorMessage = "LoadingExportableFailedGeneralErrorMessage";
|
||||
|
||||
|
||||
public const string FirewallRuleUnsupportedConnectionType = "FirewallRuleUnsupportedConnectionType";
|
||||
|
||||
|
||||
|
||||
public const string NoSubscriptionsFound = "NoSubscriptionsFound";
|
||||
|
||||
|
||||
public const string AzureServerNotFound = "AzureServerNotFound";
|
||||
|
||||
|
||||
public const string AzureSubscriptionFailedErrorMessage = "AzureSubscriptionFailedErrorMessage";
|
||||
|
||||
|
||||
public const string DatabaseDiscoveryFailedErrorMessage = "DatabaseDiscoveryFailedErrorMessage";
|
||||
|
||||
|
||||
public const string FirewallRuleAccessForbidden = "FirewallRuleAccessForbidden";
|
||||
|
||||
|
||||
public const string FirewallRuleCreationFailed = "FirewallRuleCreationFailed";
|
||||
|
||||
|
||||
public const string FirewallRuleCreationFailedWithError = "FirewallRuleCreationFailedWithError";
|
||||
|
||||
|
||||
public const string InvalidIpAddress = "InvalidIpAddress";
|
||||
|
||||
|
||||
public const string InvalidServerTypeErrorMessage = "InvalidServerTypeErrorMessage";
|
||||
|
||||
|
||||
public const string LoadingExportableFailedGeneralErrorMessage = "LoadingExportableFailedGeneralErrorMessage";
|
||||
|
||||
|
||||
public const string FirewallRuleUnsupportedConnectionType = "FirewallRuleUnsupportedConnectionType";
|
||||
|
||||
|
||||
private Keys()
|
||||
{ }
|
||||
@@ -177,7 +177,7 @@ namespace Microsoft.SqlTools.ResourceProvider.Core
|
||||
{
|
||||
return resourceManager.GetString(key, _culture);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -120,45 +120,45 @@
|
||||
<data name="NoSubscriptionsFound" xml:space="preserve">
|
||||
<value>No subscriptions were found for the currently logged in user account.</value>
|
||||
<comment></comment>
|
||||
</data>
|
||||
</data>
|
||||
<data name="AzureServerNotFound" xml:space="preserve">
|
||||
<value>The server you specified {0} does not exist in any subscription in {1}. Either you have signed in with an incorrect account or your server was removed from subscription(s) in this account. Please check your account and try again.</value>
|
||||
<comment></comment>
|
||||
</data>
|
||||
</data>
|
||||
<data name="AzureSubscriptionFailedErrorMessage" xml:space="preserve">
|
||||
<value>An error occurred while getting Azure subscriptions</value>
|
||||
<value>An error occurred while getting Azure subscriptions: {0}</value>
|
||||
<comment></comment>
|
||||
</data>
|
||||
</data>
|
||||
<data name="DatabaseDiscoveryFailedErrorMessage" xml:space="preserve">
|
||||
<value>An error occurred while getting databases from servers of type {0} from {1}</value>
|
||||
<comment></comment>
|
||||
</data>
|
||||
</data>
|
||||
<data name="FirewallRuleAccessForbidden" xml:space="preserve">
|
||||
<value>{0} does not have permission to change the server firewall rule. Try again with a different account that is an Owner or Contributor of the Azure subscription or the server.</value>
|
||||
<comment></comment>
|
||||
</data>
|
||||
</data>
|
||||
<data name="FirewallRuleCreationFailed" xml:space="preserve">
|
||||
<value>An error occurred while creating a new firewall rule.</value>
|
||||
<comment></comment>
|
||||
</data>
|
||||
</data>
|
||||
<data name="FirewallRuleCreationFailedWithError" xml:space="preserve">
|
||||
<value>An error occurred while creating a new firewall rule: '{0}'</value>
|
||||
<comment></comment>
|
||||
</data>
|
||||
</data>
|
||||
<data name="InvalidIpAddress" xml:space="preserve">
|
||||
<value>Invalid IP address</value>
|
||||
<comment></comment>
|
||||
</data>
|
||||
</data>
|
||||
<data name="InvalidServerTypeErrorMessage" xml:space="preserve">
|
||||
<value>Server Type is invalid.</value>
|
||||
<comment></comment>
|
||||
</data>
|
||||
</data>
|
||||
<data name="LoadingExportableFailedGeneralErrorMessage" xml:space="preserve">
|
||||
<value>A required dll cannot be loaded. Please repair your application.</value>
|
||||
<comment></comment>
|
||||
</data>
|
||||
</data>
|
||||
<data name="FirewallRuleUnsupportedConnectionType" xml:space="preserve">
|
||||
<value>Cannot open a firewall rule for the specified connection type</value>
|
||||
<comment></comment>
|
||||
</data>
|
||||
</root>
|
||||
</data>
|
||||
</root>
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
# Azure Core DLL
|
||||
NoSubscriptionsFound = No subscriptions were found for the currently logged in user account.
|
||||
AzureServerNotFound = The server you specified {0} does not exist in any subscription in {1}. Either you have signed in with an incorrect account or your server was removed from subscription(s) in this account. Please check your account and try again.
|
||||
AzureSubscriptionFailedErrorMessage = An error occurred while getting Azure subscriptions
|
||||
AzureSubscriptionFailedErrorMessage = An error occurred while getting Azure subscriptions: {0}
|
||||
DatabaseDiscoveryFailedErrorMessage = An error occurred while getting databases from servers of type {0} from {1}
|
||||
FirewallRuleAccessForbidden = {0} does not have permission to change the server firewall rule. Try again with a different account that is an Owner or Contributor of the Azure subscription or the server.
|
||||
FirewallRuleCreationFailed = An error occurred while creating a new firewall rule.
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
<note></note>
|
||||
</trans-unit>
|
||||
<trans-unit id="AzureSubscriptionFailedErrorMessage">
|
||||
<source>An error occurred while getting Azure subscriptions</source>
|
||||
<source>An error occurred while getting Azure subscriptions: {0}</source>
|
||||
<target state="new">An error occurred while getting Azure subscriptions</target>
|
||||
<note></note>
|
||||
</trans-unit>
|
||||
|
||||
Reference in New Issue
Block a user