< Summary

Information
Class: ArturRios.Util.WebApi.EndpointToggle.EndpointDisabledException
Assembly: ArturRios.Util.WebApi
File(s): /home/runner/work/dotnet-webapi-util/dotnet-webapi-util/src/EndpointToggle/EndpointDisabledException.cs
Line coverage
100%
Covered lines: 3
Uncovered lines: 0
Coverable lines: 3
Total lines: 23
Line coverage: 100%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage
100%
Covered methods: 3
Fully covered methods: 3
Total methods: 3
Method coverage: 100%
Full method coverage: 100%

Metrics

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

File(s)

/home/runner/work/dotnet-webapi-util/dotnet-webapi-util/src/EndpointToggle/EndpointDisabledException.cs

#LineLine coverage
 1using ArturRios.Output;
 2using Microsoft.AspNetCore.Http;
 3
 4namespace ArturRios.Util.WebApi.EndpointToggle;
 5
 6/// <summary>Exception thrown by <see cref="EndpointToggleAttribute"/> when a disabled endpoint is reached and its
 7/// disabled behavior is configured as <c>OutputType.Exception</c>. Carries one or more messages describing why the
 8/// endpoint is unavailable and the status code to answer with, letting it be handled by the exception pipeline (for
 9/// example <see cref="Middleware.ExceptionMiddleware"/>, which honors <see cref="StatusCode"/>).</summary>
 10public class EndpointDisabledException : CustomException
 11{
 12    /// <summary>Initializes a new instance answered with 404 Not Found.</summary>
 13    /// <param name="messages">The messages describing why the endpoint is disabled.</param>
 414    public EndpointDisabledException(string[] messages) : this(messages, StatusCodes.Status404NotFound) { }
 15
 16    /// <summary>Initializes a new instance answered with <paramref name="statusCode"/>.</summary>
 17    /// <param name="messages">The messages describing why the endpoint is disabled.</param>
 18    /// <param name="statusCode">The HTTP status code the disabled endpoint should answer with.</param>
 1219    public EndpointDisabledException(string[] messages, int statusCode) : base(messages) => StatusCode = statusCode;
 20
 21    /// <summary>The HTTP status code the disabled endpoint should answer with.</summary>
 222    public int StatusCode { get; }
 23}