make ExceptionData NOT nullable + add EmptyExcData record, should fix the tests
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))
+ ExceptionData: e.ExceptionData ?? new EmptyExceptionData()))
{
StatusCode = (int)HttpStatusCode.InternalServerError
},
@@ -29,7 +29,7 @@ public class ExceptionTranslateAttribute : ExceptionFilterAttribute
Type: ProtocolConstants.ProtocolViolationType,
ErrorCode: WabiSabiProtocolErrorCode.CryptoException.ToString(),
Description: e.Message,
- ExceptionData: null))
+ ExceptionData: new EmptyExceptionData()))
{
StatusCode = (int)HttpStatusCode.InternalServerError
},

MODIFY
WalletWasabi/WabiSabi/Backend/Models/ExceptionData.cs
WalletWasabi/WabiSabi/Backend/Models/ExceptionData.cs
@@ -3,3 +3,5 @@ namespace WalletWasabi.WabiSabi.Backend.Models;
public abstract record ExceptionData
{
}
+
+public record EmptyExceptionData() : ExceptionData;

MODIFY
WalletWasabi/WabiSabi/Models/Error.cs
WalletWasabi/WabiSabi/Models/Error.cs
@@ -6,5 +6,5 @@ public record Error(
string Type,
string ErrorCode,
string Description,
- ExceptionData? ExceptionData
+ ExceptionData ExceptionData
);

MODIFY
WalletWasabi/WabiSabi/Models/Serialization/ExceptionDataJsonConverter.cs
WalletWasabi/WabiSabi/Models/Serialization/ExceptionDataJsonConverter.cs
@@ -4,7 +4,7 @@ namespace WalletWasabi.WabiSabi.Models.Serialization;
public class ExceptionDataJsonConverter : GenericInterfaceJsonConverter<ExceptionData>
{
- public ExceptionDataJsonConverter() : base(new [] { typeof(InputBannedExceptionData) })
+ public ExceptionDataJsonConverter() : base(new [] { typeof(InputBannedExceptionData), typeof(EmptyExceptionData) })
{
}
}

make ExceptionData NOT nullable + add EmptyExcData record, should fix the tests