Improving profiler error messages (#658)

* Improving error messages

* Fixing stopping error message

* Cleaning up repeat error messages

* Changing error names
This commit is contained in:
Madeline MacDonald
2018-07-16 18:22:12 -07:00
committed by GitHub
parent b8c31e1138
commit ec9d51ede1
5 changed files with 69 additions and 3 deletions

View File

@@ -3669,6 +3669,14 @@ namespace Microsoft.SqlTools.ServiceLayer
}
}
public static string SessionNotFound
{
get
{
return Keys.GetString(Keys.SessionNotFound);
}
}
public static string UserCancelledSelectStep
{
get
@@ -4551,6 +4559,16 @@ namespace Microsoft.SqlTools.ServiceLayer
return Keys.GetString(Keys.EditDataIncorrectTable, tableName);
}
public static string StopSessionFailed(String error)
{
return Keys.GetString(Keys.StopSessionFailed, error);
}
public static string StartSessionFailed(String error)
{
return Keys.GetString(Keys.StartSessionFailed, error);
}
public static string EnableAlertsTitle(String serverName)
{
return Keys.GetString(Keys.EnableAlertsTitle, serverName);
@@ -6158,6 +6176,15 @@ namespace Microsoft.SqlTools.ServiceLayer
public const string AzureSystemDbProfilingError = "AzureSystemDbProfilingError";
public const string StopSessionFailed = "StopSessionFailed";
public const string StartSessionFailed = "StartSessionFailed";
public const string SessionNotFound = "SessionNotFound";
public const string EnableAlertsTitle = "EnableAlertsTitle";

View File

@@ -2027,6 +2027,20 @@
<value>Cannot profile Azure system databases</value>
<comment></comment>
</data>
<data name="StopSessionFailed" xml:space="preserve">
<value>Failed to stop session: {0}</value>
<comment>.
Parameters: 0 - error (String) </comment>
</data>
<data name="StartSessionFailed" xml:space="preserve">
<value>Failed to start session: {0}</value>
<comment>.
Parameters: 0 - error (String) </comment>
</data>
<data name="SessionNotFound" xml:space="preserve">
<value>Cannot find requested XEvent session</value>
<comment></comment>
</data>
<data name="EnableAlertsTitle" xml:space="preserve">
<value>Enable Alerts - {0}</value>
<comment>.

View File

@@ -888,6 +888,9 @@ InvalidPathError = Cannot access the specified path on the server: {0}
# Profiler
ProfilerConnectionNotFound = Connection not found
AzureSystemDbProfilingError = Cannot profile Azure system databases
StopSessionFailed(String error) = Failed to stop session: {0}
StartSessionFailed(String error) = Failed to start session: {0}
SessionNotFound = Cannot find requested XEvent session
#############################################################################
# SQL Agent

View File

@@ -3095,6 +3095,23 @@
<note>.
Parameters: 0 - unit (string) </note>
</trans-unit>
<trans-unit id="SessionNotFound">
<source>Cannot find requested XEvent session</source>
<target state="new">Cannot find requested XEvent session</target>
<note></note>
</trans-unit>
<trans-unit id="StopSessionFailed">
<source>Failed to stop session: {0}</source>
<target state="new">Failed to stop session: {0}</target>
<note>.
Parameters: 0 - error (String) </note>
</trans-unit>
<trans-unit id="StartSessionFailed">
<source>Failed to start session: {0}</source>
<target state="new">Failed to start session: {0}</target>
<note>.
Parameters: 0 - error (String) </note>
</trans-unit>
</body>
</file>
</xliff>

View File

@@ -146,7 +146,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Profiler
}
catch (Exception e)
{
await requestContext.SendError(e);
await requestContext.SendError(new Exception(SR.StartSessionFailed(e.Message)));
}
}
@@ -159,13 +159,18 @@ namespace Microsoft.SqlTools.ServiceLayer.Profiler
{
ProfilerSession session;
monitor.StopMonitoringSession(parameters.OwnerUri, out session);
session.XEventSession.Stop();
if (session == null)
{
throw new Exception(SR.SessionNotFound);
}
session.XEventSession.Stop();
await requestContext.SendResult(new StopProfilingResult{});
}
catch (Exception e)
{
await requestContext.SendError(e);
await requestContext.SendError(new Exception(SR.StopSessionFailed(e.Message)));
}
}