mirror of
https://github.com/Govor-team/Govor.git
synced 2026-09-17 16:22:49 +00:00
Stable server
was added removing messages many fixes bugs and moving to result pattern from throwing exceptions
This commit is contained in:
@@ -2,11 +2,14 @@ using AutoMapper;
|
||||
using Govor.Application.Friends;
|
||||
using Govor.Application.Infrastructure.Extensions;
|
||||
using Govor.Contracts.DTOs;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace Govor.API.Controllers.Friends;
|
||||
|
||||
[Authorize]
|
||||
[Route("api/friends")]
|
||||
[ApiController]
|
||||
public class FriendshipController : Controller
|
||||
{
|
||||
private readonly ILogger<FriendshipController> _logger;
|
||||
@@ -40,11 +43,6 @@ public class FriendshipController : Controller
|
||||
|
||||
return Ok(response);
|
||||
}
|
||||
catch (UnauthorizedAccessException ex)
|
||||
{
|
||||
_logger.LogWarning(ex, ex.Message);
|
||||
return Forbid(ex.Message);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, ex.Message);
|
||||
@@ -63,16 +61,6 @@ public class FriendshipController : Controller
|
||||
|
||||
return Ok(response);
|
||||
}
|
||||
catch (InvalidOperationException ex)
|
||||
{
|
||||
_logger.LogError(ex, ex.Message);
|
||||
return Ok(Array.Empty<UserDto>());
|
||||
}
|
||||
catch (UnauthorizedAccessException ex)
|
||||
{
|
||||
_logger.LogWarning(ex, ex.Message);
|
||||
return Forbid(ex.Message);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, ex.Message);
|
||||
|
||||
Reference in New Issue
Block a user