< Summary

Class:SVETA.Api.Controllers.ErrorController
Assembly:SVETA.Api
File(s):/opt/dev/sveta_api_build/SVETA.Api/Controllers/ErrorController.cs
Covered lines:0
Uncovered lines:9
Coverable lines:9
Total lines:35
Line coverage:0% (0 of 9)
Covered branches:0
Total branches:8
Branch coverage:0% (0 of 8)

Metrics

MethodLine coverage Branch coverage
.ctor(...)0%100%
Error()0%0%

File(s)

/opt/dev/sveta_api_build/SVETA.Api/Controllers/ErrorController.cs

#LineLine coverage
 1using System;
 2using System.Collections.Generic;
 3using System.Linq;
 4using System.Threading.Tasks;
 5using Microsoft.AspNetCore.Authorization;
 6using Microsoft.AspNetCore.Diagnostics;
 7using Microsoft.AspNetCore.Http;
 8using Microsoft.AspNetCore.Mvc;
 9using Microsoft.Extensions.Logging;
 10using SVETA.Api.Data.DTO;
 11
 12namespace SVETA.Api.Controllers
 13{
 14    [Route("api/v1/Error")]
 15    [ApiController]
 16    public class ErrorController : ControllerBase
 17    {
 18        private ILogger<ErrorController> _logger;
 019        public ErrorController(ILogger<ErrorController> logger) => _logger = logger;
 20
 21        [HttpGet("Error")]
 22        [AllowAnonymous]
 23        public IActionResult Error()
 024        {
 025            var exceptionHandlerPathFeature = HttpContext.Features.Get<IExceptionHandlerPathFeature>();
 26
 027            _logger.LogError(message: exceptionHandlerPathFeature?.Path + ": " + exceptionHandlerPathFeature?.Error.Mess
 28
 029            return StatusCode(StatusCodes.Status500InternalServerError, new ErrorDTO
 030            {
 031                error = exceptionHandlerPathFeature?.Error.Message
 032            });
 033        }
 34    }
 35}

Methods/Properties

.ctor(...)
Error()