< Summary

Information
Class: Elsa.Workflows.State.ExceptionState
Assembly: Elsa.Workflows.Core
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Workflows.Core/State/ExceptionState.cs
Line coverage
50%
Covered lines: 2
Uncovered lines: 2
Coverable lines: 4
Total lines: 28
Line coverage: 50%
Branch coverage
100%
Covered branches: 2
Total branches: 2
Branch coverage: 100%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
get_Type()100%11100%
.ctor()100%210%
FromException(...)100%22100%

File(s)

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Workflows.Core/State/ExceptionState.cs

#LineLine coverage
 1using System.Text.Json.Serialization;
 2
 3// ReSharper disable NotAccessedPositionalProperty.Global
 4
 5namespace Elsa.Workflows.State;
 6
 7/// <summary>
 8/// A simplified, serializable model representing an exception.
 9/// </summary>
 12910public record ExceptionState(Type Type, string Message, string? StackTrace, ExceptionState? InnerException)
 11{
 12    /// <summary>
 13    /// Constructor
 14    /// </summary>
 15    [JsonConstructor]
 016    public ExceptionState() : this(default!, default!, default, default)
 17    {
 18
 019    }
 20
 21    /// <summary>
 22    /// Creates a new <see cref="ExceptionState"/> from the specified exception.
 23    /// </summary>
 24    public static ExceptionState? FromException(Exception? ex)
 25    {
 317326        return ex == null ? null : new ExceptionState(ex.GetType(), ex.Message, ex.StackTrace, FromException(ex.InnerExc
 27    }
 28}