refactored responses

This commit is contained in:
2025-04-06 15:37:32 +05:00
parent 3c1d195849
commit d70b605127
17 changed files with 415 additions and 263 deletions
@@ -0,0 +1,19 @@
namespace ParadoxSaveParser.WebAPI.HttpHelpers;
public class ValueOrError<T>
{
public readonly ErrorMessage? Error;
public readonly T? Value;
private ValueOrError(T? value, ErrorMessage? error)
{
Value = value;
Error = error;
}
public bool HasError => Error is not null;
public static implicit operator ValueOrError<T>(T v) => new(v, null);
public static implicit operator ValueOrError<T>(ErrorMessage e) => new(default, e);
}