< Summary

Information
Class: Allyaria.Abstractions.Exceptions.AryException
Assembly: Allyaria.Abstractions
File(s): /home/runner/work/allyaria/allyaria/src/Allyaria.Abstractions/Exceptions/AryException.cs
Line coverage
100%
Covered lines: 4
Uncovered lines: 0
Coverable lines: 4
Total lines: 37
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

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)100%11100%
get_ErrorCode()100%11100%
get_Timestamp()100%11100%

File(s)

/home/runner/work/allyaria/allyaria/src/Allyaria.Abstractions/Exceptions/AryException.cs

#LineLine coverage
 1namespace Allyaria.Abstractions.Exceptions;
 2
 3/// <summary>
 4/// Represents the base exception type for Allyaria applications. All custom exceptions within the Allyaria ecosystem
 5/// should derive from this type.
 6/// </summary>
 7public class AryException : Exception
 8{
 9    /// <summary>
 10    /// Initializes a new instance of the <see cref="AryException" /> class with an optional message, an optional error 
 11    /// and an optional inner exception.
 12    /// </summary>
 13    /// <param name="message">
 14    /// The error message that explains the reason for the exception. This value is typically localized before being pas
 15    /// into the constructor.
 16    /// </param>
 17    /// <param name="errorCode">
 18    /// An optional, structured error code that categorizes the error. When <see langword="null" /> or empty, this value
 19    /// defaults to <c>"ARY.UNKNOWN"</c>.
 20    /// </param>
 21    /// <param name="innerException">
 22    /// The exception that is the cause of the current exception, or <see langword="null" /> if no inner exception is
 23    /// specified.
 24    /// </param>
 25    public AryException(string? message = null, string? errorCode = null, Exception? innerException = null)
 40626        : base(message: message, innerException: innerException)
 40627        => ErrorCode = errorCode.OrDefaultIfEmpty(defaultValue: "ARY.UNKNOWN");
 28
 29    /// <summary>Gets the structured error code associated with this exception instance.</summary>
 30    /// <remarks>
 31    /// If no explicit error code is provided when constructing the exception, this property defaults to <c>"ARY.UNKNOWN
 32    /// </remarks>
 7833    public string ErrorCode { get; }
 34
 35    /// <summary>Gets the UTC timestamp indicating when this exception instance was created.</summary>
 41836    public DateTimeOffset Timestamp { get; } = DateTimeOffset.UtcNow;
 37}