< Summary

Information
Class: AsiBackbone.Core.Emissions.GovernanceEmissionError
Assembly: AsiBackbone.Core
File(s): /home/runner/work/AsiBackbone/AsiBackbone/src/AsiBackbone.Core/Emissions/GovernanceEmissionError.cs
Line coverage
100%
Covered lines: 28
Uncovered lines: 0
Coverable lines: 28
Total lines: 80
Line coverage: 100%
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
.ctor(...)100%11100%
get_Code()100%11100%
get_Message()100%11100%
get_IsRetryable()100%11100%
get_ProviderName()100%11100%
get_ProviderErrorCode()100%11100%
Create(...)100%11100%
NormalizeOptional(...)100%22100%

File(s)

/home/runner/work/AsiBackbone/AsiBackbone/src/AsiBackbone.Core/Emissions/GovernanceEmissionError.cs

#LineLine coverage
 1namespace AsiBackbone.Core.Emissions;
 2
 3/// <summary>
 4/// Represents provider-neutral error information for a governance emission attempt.
 5/// </summary>
 6public sealed class GovernanceEmissionError
 7{
 668    private GovernanceEmissionError(
 669        string code,
 6610        string message,
 6611        bool isRetryable,
 6612        string? providerName,
 6613        string? providerErrorCode)
 14    {
 6615        ArgumentException.ThrowIfNullOrWhiteSpace(code);
 6516        ArgumentException.ThrowIfNullOrWhiteSpace(message);
 17
 6418        Code = code.Trim();
 6419        Message = message.Trim();
 6420        IsRetryable = isRetryable;
 6421        ProviderName = NormalizeOptional(providerName);
 6422        ProviderErrorCode = NormalizeOptional(providerErrorCode);
 6423    }
 24
 25    /// <summary>
 26    /// Gets the provider-neutral error code.
 27    /// </summary>
 4628    public string Code { get; }
 29
 30    /// <summary>
 31    /// Gets the provider-neutral diagnostic message.
 32    /// </summary>
 2233    public string Message { get; }
 34
 35    /// <summary>
 36    /// Gets a value indicating whether the error is expected to be retryable.
 37    /// </summary>
 5138    public bool IsRetryable { get; }
 39
 40    /// <summary>
 41    /// Gets the provider name associated with the error, when available.
 42    /// </summary>
 7243    public string? ProviderName { get; }
 44
 45    /// <summary>
 46    /// Gets the provider-specific error code, when safe and available.
 47    /// </summary>
 2148    public string? ProviderErrorCode { get; }
 49
 50    /// <summary>
 51    /// Creates provider-neutral error information for a governance emission attempt.
 52    /// </summary>
 53    /// <param name="code">The provider-neutral error code.</param>
 54    /// <param name="message">The provider-neutral diagnostic message.</param>
 55    /// <param name="isRetryable">A value indicating whether the error is expected to be retryable.</param>
 56    /// <param name="providerName">Optional provider name.</param>
 57    /// <param name="providerErrorCode">Optional provider-specific error code.</param>
 58    /// <returns>The governance emission error.</returns>
 59    public static GovernanceEmissionError Create(
 60        string code,
 61        string message,
 62        bool isRetryable = false,
 63        string? providerName = null,
 64        string? providerErrorCode = null)
 65    {
 6666        return new GovernanceEmissionError(
 6667            code,
 6668            message,
 6669            isRetryable,
 6670            providerName,
 6671            providerErrorCode);
 72    }
 73
 74    private static string? NormalizeOptional(string? value)
 75    {
 12876        return string.IsNullOrWhiteSpace(value)
 12877            ? null
 12878            : value.Trim();
 79    }
 80}