diff --git a/src/DigitalData.UserManager.API/Controllers/AuthController.cs b/src/DigitalData.UserManager.API/Controllers/AuthController.cs index b469a4f..98048c2 100644 --- a/src/DigitalData.UserManager.API/Controllers/AuthController.cs +++ b/src/DigitalData.UserManager.API/Controllers/AuthController.cs @@ -40,26 +40,18 @@ public class AuthController : ControllerBase [Obsolete("Use MediatR")] public async Task GetUserWithClaims() { - try - { - // Extract the username from the Name claim. - string? username = User.Claims.FirstOrDefault(c => c.Type == ClaimTypes.Name)?.Value; + // Extract the username from the Name claim. + string? username = User.Claims.FirstOrDefault(c => c.Type == ClaimTypes.Name)?.Value; - if (string.IsNullOrEmpty(username)) - return Unauthorized(); + if (string.IsNullOrEmpty(username)) + return Unauthorized(); - return await _userService.ReadByUsernameAsync(username) - .ThenAsync(Ok, IActionResult (m, n) => - { - _logger.LogNotice(n); - return NotFound(Result.Fail().Message(_localizer[Key.UserNotFound])); - }); - } - catch (Exception ex) - { - _logger.LogError(ex, "{Message}", ex.Message); - return StatusCode(StatusCodes.Status500InternalServerError); - } + return await _userService.ReadByUsernameAsync(username) + .ThenAsync(Ok, IActionResult (m, n) => + { + _logger.LogNotice(n); + return NotFound(Result.Fail().Message(_localizer[Key.UserNotFound])); + }); } [Authorize]