diff --git a/.gitea/workflows/publish-nuget.yaml b/.gitea/workflows/publish-nuget.yaml index 5e45671..12edbbf 100644 --- a/.gitea/workflows/publish-nuget.yaml +++ b/.gitea/workflows/publish-nuget.yaml @@ -16,7 +16,7 @@ jobs: - name: Setup .NET uses: https://github.com/actions/setup-dotnet@v3 with: - dotnet-version: 8.x + dotnet-version: 9.x - name: Restore dependencies run: dotnet restore Railway/Railway.csproj diff --git a/.gitea/workflows/test-dotnet.yaml b/.gitea/workflows/test-dotnet.yaml index 3fab52d..3dfb5d8 100644 --- a/.gitea/workflows/test-dotnet.yaml +++ b/.gitea/workflows/test-dotnet.yaml @@ -21,7 +21,7 @@ jobs: - name: Setup .NET uses: https://github.com/actions/setup-dotnet@v3 with: - dotnet-version: 8.x + dotnet-version: 9.x - name: Restore dependencies run: dotnet restore @@ -30,12 +30,12 @@ jobs: run: dotnet build --no-restore - name: Test - run: dotnet test --no-build --verbosity normal --logger trx --results-directory "TestResults-8.x" + run: dotnet test --no-build --verbosity normal --logger trx --results-directory "TestResults-9.x" - name: Upload dotnet test results uses: actions/upload-artifact@v3 with: - name: dotnet-results-8.x - path: TestResults-8.x + name: dotnet-results-9.x + path: TestResults-9.x if: ${{ always() }} retention-days: 30 diff --git a/LICENSE b/LICENSE index 0543fbb..ded1dcf 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2023-2024 JustFixMe +Copyright (c) 2023-2025 JustFixMe Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/Railway/Error.cs b/Railway/Error.cs index 66b8298..3159678 100644 --- a/Railway/Error.cs +++ b/Railway/Error.cs @@ -221,15 +221,22 @@ public sealed class ExceptionalError : Error private static ImmutableDictionary ExtractExtensionData(Exception exception) { if (!(exception.Data?.Count > 0)) - return ImmutableDictionary.Empty; + return ImmutableDictionary.Empty; + var values = GetGenericExtData(exception); + + return values is not null ? values.ToImmutable() : ImmutableDictionary.Empty; + } + + private static ImmutableDictionary.Builder? GetGenericExtData(Exception ex) + { ImmutableDictionary.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(); values.Add(keyString, valueString); } - return values is not null ? values.ToImmutable() : ImmutableDictionary.Empty; + + return values; } } diff --git a/Railway/Railway.csproj b/Railway/Railway.csproj index a4767e1..478acfc 100644 --- a/Railway/Railway.csproj +++ b/Railway/Railway.csproj @@ -1,7 +1,7 @@ - net6.0;net7.0;net8.0 + net6.0;net7.0;net8.0;net9.0 10.0 enable enable diff --git a/Railway/ResultExtensions.cs b/Railway/ResultExtensions.cs index 468a1cb..8e02c6e 100644 --- a/Railway/ResultExtensions.cs +++ b/Railway/ResultExtensions.cs @@ -5,7 +5,7 @@ namespace Just.Railway; public static partial class ResultExtensions { #region Match (with fallback) - + public static T Match(this in Result result, Func fallback) { return result.State switch @@ -15,7 +15,7 @@ public static partial class ResultExtensions _ => throw new ResultNotInitializedException(nameof(result)) }; } - + public static async Task Match(this Result result, Func> fallback) { return result.State switch @@ -77,7 +77,7 @@ public static partial class ResultExtensions } #endregion - + #region Merge public static Result Merge(this IEnumerable results) diff --git a/Raliway.Tests/Raliway.Tests.csproj b/Raliway.Tests/Raliway.Tests.csproj index 396ba8a..8b5cf41 100644 --- a/Raliway.Tests/Raliway.Tests.csproj +++ b/Raliway.Tests/Raliway.Tests.csproj @@ -1,7 +1,7 @@ - net8.0 + net9.0 enable enable @@ -11,13 +11,13 @@ - - - + + + runtime; build; native; contentfiles; analyzers; buildtransitive all - + runtime; build; native; contentfiles; analyzers; buildtransitive all