protected bool TrySetError(StormError error) { if (IsError(error)) { return(false); } SetError(error); return(true); }
static object OnError(StormError obj) => obj;
static string Error(StormError error) => $"err: '{error.Message}'";
public ImmutableError(StormError error) { _error = error ?? throw new ArgumentNullException(nameof(error)); }
public IStorm <T> CreateError <T>(StormError error) => new ImmutableError <T>(error);
public void SetError(StormToken token, StormError error) { if (token.Equals(default)) throw new ArgumentException("Default token not allowed", nameof(token));
protected void SetError(StormError error) { _hasValue = false; _error = error; _value = default; }
protected bool IsError(StormError error) => !_hasValue && Equals(error, _error);