Browse Source

Trim file paths in exception message

CPKreuz 7 months ago
parent
commit
9693e0784a

+ 1 - 1
src/PixiEditor/Helpers/CrashHelper.cs

@@ -134,7 +134,7 @@ internal partial class CrashHelper
         }
         }
     }
     }
 
 
-    private static string TrimFilePaths(string text) => FilePathRegex().Replace(text, "{{ FILE PATH }}");
+    public static string TrimFilePaths(string text) => FilePathRegex().Replace(text, "{{ FILE PATH }}");
     
     
     public static void SendExceptionInfo(Exception e, bool wait = false,
     public static void SendExceptionInfo(Exception e, bool wait = false,
         [CallerFilePath] string filePath = "<unknown>", [CallerMemberName] string memberName = "<unknown>")
         [CallerFilePath] string filePath = "<unknown>", [CallerMemberName] string memberName = "<unknown>")

+ 3 - 1
src/PixiEditor/Models/AnalyticsAPI/ExceptionDetails.cs

@@ -1,3 +1,5 @@
+using PixiEditor.Helpers;
+
 namespace PixiEditor.Models.AnalyticsAPI;
 namespace PixiEditor.Models.AnalyticsAPI;
 
 
 public class ExceptionDetails
 public class ExceptionDetails
@@ -32,7 +34,7 @@ public class ExceptionDetails
         ArgumentNullException.ThrowIfNull(ex);
         ArgumentNullException.ThrowIfNull(ex);
 
 
         ExceptionType = ex.GetType().FullName;
         ExceptionType = ex.GetType().FullName;
-        Message = ex.Message;
+        Message = CrashHelper.TrimFilePaths(ex.Message);
         StackTrace = ex.StackTrace;
         StackTrace = ex.StackTrace;
         InnerExceptions = [];
         InnerExceptions = [];