Fix logging of exception titles

このコミットが含まれているのは:
Sergio Pedri committed 2022-01-22 22:35:02 +01:00
1 親 b6b39f4c8f
コミット ea68ebe527
7ファイル変更
+18 -11

検索条件に一致するファイルはありません

@@ -9,6 +9,7 @@
<Import_RootNamespace>ComputeSharp.SwapChain.Core.Shared</Import_RootNamespace>
</PropertyGroup>
<ItemGroup>
<Compile Include="$(MSBuildThisFileDirectory)Constants\Error.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Constants\Event.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Converters\RenderingPauseConverter.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Converters\ResolutionScaleConverter.cs" />
+10
ファイルの表示
@@ -0,0 +1,10 @@
namespace ComputeSharp.SwapChain.Core.Constants;
/// <summary>
/// A <see langword="class"/> with the collection of tracked errors for analytics.
/// </summary>
public static class Error
{
public const string RenderingFailedOnMainPanel = "[SHELL] RenderingFailed (main panel)";
public const string RenderingFailedOnSelectionPanel = "[SHELL] RenderingFailed (selection panel)";
}
-2
ファイルの表示
@@ -12,6 +12,4 @@ public static class Event
public const string IsRenderingPausedChanged = "[SETTINGS] IsRenderingPaused";
public const string OpenShaderSelectionPanel = "[SHELL] Open ShaderSelectionPanel";
public const string CloseShaderSelectionPanel = "[SHELL] Close ShaderSelectionPanel";
public const string RenderingFailedOnMainPanel = "[SHELL] RenderingFailed (main panel)";
public const string RenderingFailedOnSelectionPanel = "[SHELL] RenderingFailed (selection panel)";
}
+2 -3
ファイルの表示
@@ -30,12 +30,11 @@ public sealed class DebugAnalyticsService : IAnalyticsService
}
/// <inheritdoc/>
public void Log(string title, Exception exception, params (string Property, object? Value)[]? data)
public void Log(Exception exception, params (string Property, object? Value)[]? data)
{
StringBuilder builder = new();
builder.AppendLine($"[EXCEPTION]: \"{title}\"");
builder.AppendLine($">> Type: \"{exception.GetType()}\"");
builder.AppendLine($"[EXCEPTION]: \"{exception.GetType()}\"");
builder.AppendLine(">> Stack trace");
builder.AppendLine(exception.StackTrace);
+2 -3
ファイルの表示
@@ -17,10 +17,9 @@ public interface IAnalyticsService
void Log(string title, params (string Property, object? Value)[]? data);
/// <summary>
/// Logs an exception with a specified title and optional properties.
/// Logs an exception with optional properties.
/// </summary>
/// <param name="title">The title of the event to track.</param>
/// <param name="exception">The exception that has been thrown.</param>
/// <param name="data">The optional event properties.</param>
void Log(string title, Exception exception, params (string Property, object? Value)[]? data);
void Log(Exception exception, params (string Property, object? Value)[]? data);
}
+1 -1
ファイルの表示
@@ -34,7 +34,7 @@ public sealed class AppCenterService : IAnalyticsService
}
/// <inheritdoc/>
public void Log(string title, Exception exception, params (string Property, object? Value)[]? data)
public void Log(Exception exception, params (string Property, object? Value)[]? data)
{
Crashes.TrackError(exception, GetProperties(data));
}
+2 -2
ファイルの表示
@@ -52,12 +52,12 @@ public sealed partial class MainView : UserControl
// Logs rendering failed in the main panel
private void MainShaderPanel_RenderingFailed(AnimatedComputeShaderPanel sender, Exception args)
{
Ioc.Default.GetRequiredService<IAnalyticsService>().Log(Event.RenderingFailedOnMainPanel, args);
Ioc.Default.GetRequiredService<IAnalyticsService>().Log(args, (nameof(Error), Error.RenderingFailedOnMainPanel));
}
// Logs rendering failed in a secondary panel
private void SelectionShaderPanel_RenderingFailed(AnimatedComputeShaderPanel sender, Exception args)
{
Ioc.Default.GetRequiredService<IAnalyticsService>().Log(Event.RenderingFailedOnSelectionPanel, args);
Ioc.Default.GetRequiredService<IAnalyticsService>().Log(args, (nameof(Error), Error.RenderingFailedOnSelectionPanel));
}
}