• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

AndreuCodina / CrossValidation / 5940305339

22 Aug 2023 02:36PM UTC coverage: 92.715% (-2.7%) from 95.391%
5940305339

push

github

web-flow
Problem Details service MVP (#74)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: dependabot[bot] <dependabot[bot]@users.noreply.github.com>
Co-authored-by: AndreuCodina <AndreuCodina@users.noreply.github.com>

431 of 486 branches covered (88.68%)

Branch coverage included in aggregate %.

299 of 299 new or added lines in 21 files covered. (100.0%)

1389 of 1477 relevant lines covered (94.04%)

176.66 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/CrossValidation/DependencyInjection/GlobalExceptionMiddleware.cs
1
using CrossValidation.Exceptions;
2
using Microsoft.AspNetCore.Http;
3
using Microsoft.Extensions.Logging;
4

5
namespace CrossValidation.DependencyInjection;
6

7
internal class GlobalExceptionMiddleware : IMiddleware
8
{
9
    private readonly ILogger<GlobalExceptionMiddleware> _logger;
10

11
    public GlobalExceptionMiddleware(ILoggerFactory loggerFactory)
×
12
    {
13
        _logger = loggerFactory.CreateLogger<GlobalExceptionMiddleware>();
×
14
    }
×
15
    
16
    public async Task InvokeAsync(HttpContext context, RequestDelegate next)
17
    {
18
        try
19
        {
20
            await next(context);
×
21
        }
×
22
        catch (Exception e)
×
23
        {
24
            HandleUnexpectedException(e, context);
×
25
            throw;
×
26
        }
27
    }
×
28

29
    private void HandleUnexpectedException(Exception exception, HttpContext context)
30
    {
31
        if (CrossValidationOptions.HandleUnknownException
×
32
            && exception is BusinessException or BusinessListException)
×
33
        {
34
            return;
×
35
        }
36

37
        _logger.LogError(exception, exception.Message);
×
38
    }
×
39
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc