Use EmptyExceptionData static readonly Instance prop, isntead of creating them with new()
MODIFY
WalletWasabi.Backend/Filters/ExceptionTranslateFilter.cs
WalletWasabi.Backend/Filters/ExceptionTranslateFilter.cs
@@ -21,7 +21,7 @@ public class ExceptionTranslateAttribute : ExceptionFilterAttribute
Type: ProtocolConstants.ProtocolViolationType,
ErrorCode: e.ErrorCode.ToString(),
Description: e.Message,
- ExceptionData: e.ExceptionData ?? new EmptyExceptionData()))
+ ExceptionData: e.ExceptionData ?? EmptyExceptionData.Instance))
{
StatusCode = (int)HttpStatusCode.InternalServerError
},
@@ -29,7 +29,7 @@ public class ExceptionTranslateAttribute : ExceptionFilterAttribute
Type: ProtocolConstants.ProtocolViolationType,
ErrorCode: WabiSabiProtocolErrorCode.CryptoException.ToString(),
Description: e.Message,
- ExceptionData: new EmptyExceptionData()))
+ ExceptionData: EmptyExceptionData.Instance))
{
StatusCode = (int)HttpStatusCode.InternalServerError
},

MODIFY
WalletWasabi/WabiSabi/Backend/Models/ExceptionData.cs
WalletWasabi/WabiSabi/Backend/Models/ExceptionData.cs
@@ -4,4 +4,7 @@ public abstract record ExceptionData
{
}
-public record EmptyExceptionData() : ExceptionData;
+public record EmptyExceptionData() : ExceptionData
+{
+ public static readonly EmptyExceptionData Instance = new();
+}

Use EmptyExceptionData static readonly Instance prop, isntead of creating them with new()