Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
gumbarros committed Jan 9, 2025
2 parents 66af535 + ec8d7c3 commit eddd7d1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/WebApi/Controllers/ErrorController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,20 @@ namespace JJMasterData.WebApi.Controllers;

[ApiController]
[ApiExplorerSettings(IgnoreApi = true)]
public class ErrorController : ControllerBase
public class ErrorController(ILogger<ErrorController> logger) : ControllerBase
{
[Route("/Error")]
public IActionResult HandleError()
{
var exceptionHandlerFeature =
HttpContext.Features.Get<IExceptionHandlerFeature>()!;

var responseLetter = ExceptionManager.GetResponse(exceptionHandlerFeature.Error);
var error = exceptionHandlerFeature.Error;

var responseLetter = ExceptionManager.GetResponse(error);

logger.LogCritical(error, "Unexpected error at WebApi.");

return new ObjectResult(responseLetter)
{
StatusCode = responseLetter.Status
Expand Down
1 change: 1 addition & 0 deletions src/WebApi/WebApi.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<RootNamespace>JJMasterData.WebApi</RootNamespace>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<PackageId>JJMasterData.WebApi</PackageId>
<AssemblyName>JJMasterData.WebApi</AssemblyName>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<OutputType>library</OutputType>
<OpenApiGenerateDocuments>false</OpenApiGenerateDocuments>
Expand Down

0 comments on commit eddd7d1

Please sign in to comment.