< 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: 23
Uncovered lines: 0
Coverable lines: 23
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%
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{
 1668    private GovernanceEmissionError(
 1669        string code,
 16610        string message,
 16611        bool isRetryable,
 16612        string? providerName,
 16613        string? providerErrorCode)
 14    {
 16615        ArgumentException.ThrowIfNullOrWhiteSpace(code);
 16316        ArgumentException.ThrowIfNullOrWhiteSpace(message);
 17
 16018        Code = code.Trim();
 16019        Message = message.Trim();
 16020        IsRetryable = isRetryable;
 16021        ProviderName = NormalizeOptional(providerName);
 16022        ProviderErrorCode = NormalizeOptional(providerErrorCode);
 16023    }
 24
 25    /// <summary>
 26    /// Gets the provider-neutral error code.
 27    /// </summary>
 28    public string Code { get; }
 29
 30    /// <summary>
 31    /// Gets the provider-neutral diagnostic message.
 32    /// </summary>
 33    public string Message { get; }
 34
 35    /// <summary>
 36    /// Gets a value indicating whether the error is expected to be retryable.
 37    /// </summary>
 38    public bool IsRetryable { get; }
 39
 40    /// <summary>
 41    /// Gets the provider name associated with the error, when available.
 42    /// </summary>
 43    public string? ProviderName { get; }
 44
 45    /// <summary>
 46    /// Gets the provider-specific error code, when safe and available.
 47    /// </summary>
 48    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    {
 16666        return new GovernanceEmissionError(
 16667            code,
 16668            message,
 16669            isRetryable,
 16670            providerName,
 16671            providerErrorCode);
 72    }
 73
 74    private static string? NormalizeOptional(string? value)
 75    {
 32076        return string.IsNullOrWhiteSpace(value)
 32077            ? null
 32078            : value.Trim();
 79    }
 80}