support for dotnet9 compilation
All checks were successful
.NET Test / test (push) Successful in 2m2s
All checks were successful
.NET Test / test (push) Successful in 2m2s
This commit is contained in:
@@ -221,15 +221,22 @@ public sealed class ExceptionalError : Error
|
||||
private static ImmutableDictionary<string, string> ExtractExtensionData(Exception exception)
|
||||
{
|
||||
if (!(exception.Data?.Count > 0))
|
||||
return ImmutableDictionary<string, string>.Empty;
|
||||
return ImmutableDictionary<string, string>.Empty;
|
||||
|
||||
var values = GetGenericExtData(exception);
|
||||
|
||||
return values is not null ? values.ToImmutable() : ImmutableDictionary<string, string>.Empty;
|
||||
}
|
||||
|
||||
private static ImmutableDictionary<string, string>.Builder? GetGenericExtData(Exception ex)
|
||||
{
|
||||
ImmutableDictionary<string, string>.Builder? values = null;
|
||||
|
||||
foreach (var key in exception.Data.Keys)
|
||||
foreach (var key in ex.Data.Keys)
|
||||
{
|
||||
if (key is null) continue;
|
||||
|
||||
var value = exception.Data[key];
|
||||
var value = ex.Data[key];
|
||||
if (value is null) continue;
|
||||
|
||||
var keyString = key.ToString();
|
||||
@@ -239,7 +246,8 @@ public sealed class ExceptionalError : Error
|
||||
values ??= ImmutableDictionary.CreateBuilder<string, string>();
|
||||
values.Add(keyString, valueString);
|
||||
}
|
||||
return values is not null ? values.ToImmutable() : ImmutableDictionary<string, string>.Empty;
|
||||
|
||||
return values;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>net6.0;net7.0;net8.0</TargetFrameworks>
|
||||
<TargetFrameworks>net6.0;net7.0;net8.0;net9.0</TargetFrameworks>
|
||||
<LangVersion>10.0</LangVersion>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
|
||||
@@ -5,7 +5,7 @@ namespace Just.Railway;
|
||||
public static partial class ResultExtensions
|
||||
{
|
||||
#region Match (with fallback)
|
||||
|
||||
|
||||
public static T Match<T>(this in Result<T> result, Func<Error, T> fallback)
|
||||
{
|
||||
return result.State switch
|
||||
@@ -15,7 +15,7 @@ public static partial class ResultExtensions
|
||||
_ => throw new ResultNotInitializedException(nameof(result))
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
public static async Task<T> Match<T>(this Result<T> result, Func<Error, Task<T>> fallback)
|
||||
{
|
||||
return result.State switch
|
||||
@@ -77,7 +77,7 @@ public static partial class ResultExtensions
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Merge
|
||||
|
||||
public static Result Merge(this IEnumerable<Result> results)
|
||||
|
||||
Reference in New Issue
Block a user