Table of Contents

Namespace Arc4u.Results

Classes

ProblemDetailError

Create an Error that will be translated into a ProblemDetails. Detail will be assigned to the existing Message property of FluentResults.Error.

ResultExtension

Reads a use case out loud: OnSuccess / OnSuccessNull / OnSuccessNotNull / OnFailed describe what happens to a FluentResults.Result without the caller writing a single if statement.

Two rules keep that readability honest:

  1. A method named *Async always returns a Task or a ValueTask, so the caller must await it. Nothing in this class ever blocks on a Task (no .Wait(), no .Result).
  2. A method NOT named *Async never accepts an asynchronous callback. Passing one is a compile error pointing at the *Async twin, because an async lambda bound to an Action would run as 'async void': fire-and-forget, with nothing awaiting it. Its exception would then surface on a thread pool thread instead of at the caller's await.

The *Async twins take Task-returning callbacks. Adapt a ValueTask-returning call with an async lambda ('async () => await SaveAsync()') or with .AsTask(): a second overload taking Func<ValueTask> would make every async lambda ambiguous.

None of these methods turns an exception thrown by a callback into a failed Result: the exception propagates to the caller. Use FluentResults' Result.Try for that conversion.