< Summary - Kestrun — Combined Coverage

Information
Class: Kestrun.Logging.Data.ErrorRecordWrapper
Assembly: Kestrun
File(s): /home/runner/work/Kestrun/Kestrun/src/CSharp/Kestrun/Logging/Data/ErrorRecordWrapper.cs
Tag: Kestrun/Kestrun@9d3a582b2d63930269564a7591aa77ef297cadeb
Line coverage
100%
Covered lines: 11
Uncovered lines: 0
Coverable lines: 11
Total lines: 58
Line coverage: 100%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Coverage history

Coverage history 0 25 50 75 100

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)50%44100%
get_CategoryInfo()100%11100%
get_ErrorDetails()100%11100%
get_FullyQualifiedErrorId()100%11100%
get_InvocationInfoWrapper()100%11100%
get_PipelineIterationInfo()100%11100%
get_ScriptStackTrace()100%11100%
get_TargetObject()100%11100%
get_ExceptionMessage()100%11100%
get_ExceptionDetails()100%11100%
ToString()100%11100%

File(s)

/home/runner/work/Kestrun/Kestrun/src/CSharp/Kestrun/Logging/Data/ErrorRecordWrapper.cs

#LineLine coverage
 1using System.Collections.ObjectModel;
 2using System.Management.Automation;
 3using Kestrun.Logging.Enrichers.Extensions;
 4
 5namespace Kestrun.Logging.Data;
 6
 7/// <summary>
 8/// Wraps an ErrorRecord object to provide additional logging information.
 9/// </summary>
 10/// <remarks>
 11/// Initializes a new instance of the <see cref="ErrorRecordWrapper"/> class using the specified <see cref="ErrorRecord"
 12/// </remarks>
 13/// <param name="errorRecord">The error record to wrap.</param>
 314public class ErrorRecordWrapper(ErrorRecord errorRecord)
 15{
 16    /// <summary>
 17    /// Gets the error category information associated with the error record.
 18    /// </summary>
 619    public ErrorCategoryInfo CategoryInfo { get; } = errorRecord.CategoryInfo;
 20    /// <summary>
 21    /// Gets or sets the error details associated with the error record.
 22    /// </summary>
 523    public ErrorDetails ErrorDetails { get; set; } = errorRecord.ErrorDetails;
 24    /// <summary>
 25    /// Gets the fully qualified error ID associated with the error record.
 26    /// </summary>
 627    public string FullyQualifiedErrorId { get; } = errorRecord.FullyQualifiedErrorId;
 28    /// <summary>
 29    /// Gets the invocation information wrapper associated with the error record.
 30    /// </summary>
 731    public InvocationInfoWrapper InvocationInfoWrapper { get; } = new InvocationInfoWrapper(errorRecord.InvocationInfo);
 32    /// <summary>
 33    /// Gets the pipeline iteration information associated with the error record.
 34    /// </summary>
 535    public ReadOnlyCollection<int> PipelineIterationInfo { get; } = errorRecord.PipelineIterationInfo;
 36    /// <summary>
 37    /// Gets the script stack trace associated with the error record.
 38    /// </summary>
 539    public string ScriptStackTrace { get; } = errorRecord.ScriptStackTrace;
 40    /// <summary>
 41    /// Gets the target object associated with the error record.
 42    /// </summary>
 543    public object TargetObject { get; } = errorRecord.TargetObject;
 44    /// <summary>
 45    /// Gets the exception message associated with the error record, if available.
 46    /// </summary>
 547    public string? ExceptionMessage { get; } = errorRecord.Exception?.Message;
 48    /// <summary>
 49    /// Gets the exception details associated with the error record, if available.
 50    /// </summary>
 551    public string? ExceptionDetails { get; } = errorRecord.Exception?.ToString();
 52
 53    /// <summary>
 54    /// Returns a string representation of the current <see cref="ErrorRecordWrapper"/> instance.
 55    /// </summary>
 56    /// <returns>A string representation of the error record wrapper.</returns>
 157    public override string ToString() => this.ToTable();
 58}