< Summary

Information
Class: Elsa.Workflows.Exceptions.OutputConversionException
Assembly: Elsa.Workflows.Core
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Workflows.Core/Exceptions/OutputConversionException.cs
Line coverage
100%
Covered lines: 33
Uncovered lines: 0
Coverable lines: 33
Total lines: 81
Line coverage: 100%
Branch coverage
75%
Covered branches: 6
Total branches: 8
Branch coverage: 75%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)50%44100%
get_ConverterId()100%11100%
get_Stage()100%11100%
get_ActivityId()100%11100%
get_ActivityType()100%11100%
get_OutputName()100%11100%
get_DestinationId()100%11100%
get_SourceTypeName()100%11100%
get_DestinationTypeName()100%11100%
GetSafeMetadata()100%44100%
CreateMessage(...)100%11100%

File(s)

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Workflows.Core/Exceptions/OutputConversionException.cs

#LineLine coverage
 1namespace Elsa.Workflows.Exceptions;
 2
 3/// <summary>
 4/// Represents a privacy-safe failure while converting an activity output's bound value.
 5/// </summary>
 6public class OutputConversionException : Exception, ISafeExceptionMetadataProvider
 7{
 8    /// <summary>
 9    /// Initializes a new output conversion exception.
 10    /// </summary>
 11    public OutputConversionException(
 12        string converterId,
 13        OutputConversionFailureStage stage,
 14        string activityId,
 15        string activityType,
 16        string outputName,
 17        string? destinationId,
 18        Type sourceType,
 19        Type? destinationType,
 20        Exception? innerException = null)
 1021        : base(CreateMessage(converterId, stage, activityId, outputName), innerException)
 22    {
 1023        ConverterId = converterId;
 1024        Stage = stage;
 1025        ActivityId = activityId;
 1026        ActivityType = activityType;
 1027        OutputName = outputName;
 1028        DestinationId = destinationId;
 1029        SourceTypeName = sourceType.FullName ?? sourceType.Name;
 1030        DestinationTypeName = destinationType?.FullName;
 1031    }
 32
 33    /// <summary>The configured converter ID.</summary>
 334    public string ConverterId { get; }
 35
 36    /// <summary>The stage at which conversion failed.</summary>
 1137    public OutputConversionFailureStage Stage { get; }
 38
 39    /// <summary>The definition ID of the activity producing the output.</summary>
 340    public string ActivityId { get; }
 41
 42    /// <summary>The activity type name.</summary>
 343    public string ActivityType { get; }
 44
 45    /// <summary>The declared output name.</summary>
 346    public string OutputName { get; }
 47
 48    /// <summary>The optional destination ID.</summary>
 649    public string? DestinationId { get; }
 50
 51    /// <summary>The declared source type name.</summary>
 352    public string SourceTypeName { get; }
 53
 54    /// <summary>The optional declared destination type name.</summary>
 655    public string? DestinationTypeName { get; }
 56
 57    /// <inheritdoc />
 58    public IReadOnlyDictionary<string, string> GetSafeMetadata()
 59    {
 360        var metadata = new Dictionary<string, string>(StringComparer.Ordinal)
 361        {
 362            [nameof(ConverterId)] = ConverterId,
 363            [nameof(Stage)] = Stage.ToString(),
 364            [nameof(ActivityId)] = ActivityId,
 365            [nameof(ActivityType)] = ActivityType,
 366            [nameof(OutputName)] = OutputName,
 367            [nameof(SourceTypeName)] = SourceTypeName
 368        };
 69
 370        if (DestinationId != null)
 371            metadata[nameof(DestinationId)] = DestinationId;
 72
 373        if (DestinationTypeName != null)
 374            metadata[nameof(DestinationTypeName)] = DestinationTypeName;
 75
 376        return metadata;
 77    }
 78
 79    private static string CreateMessage(string converterId, OutputConversionFailureStage stage, string activityId, strin
 1080        $"Output converter '{converterId}' failed during {stage} for output '{outputName}' of activity '{activityId}'.";
 81}