แก้ปัญหา GlobalExceptionMiddleware Resturn Response 200 เมื่อมมี Exception 500

This commit is contained in:
Suphonchai Phoonsawat 2023-07-28 10:38:30 +07:00
parent 70cc95e408
commit 9a2e487d8d
4 changed files with 38 additions and 5 deletions

View file

@ -23,5 +23,12 @@ namespace BMA.EHR.Application.Repositories.Commands
}
#endregion
#region " Methods "
#endregion
}
}

View file

@ -280,6 +280,32 @@ namespace BMA.EHR.Command.Service.Controllers
}
}
/// <summary>
/// PM7-26 : ข้อมูลเลือกรายชื่อออกคำสั่ง
/// </summary>
/// <param name="orderId">Record Id ของคำสั่ง</param>
/// <returns></returns>
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpGet("persons/{orderId}")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
[AllowAnonymous]
public async Task<ActionResult<ResponseObject>> GetCommandReceiver(Guid orderId)
{
try
{
throw new NotImplementedException();
}
catch
{
throw;
}
}
#endregion
}
}

View file

@ -74,6 +74,7 @@ namespace BMA.EHR.Domain.Middlewares
responseModel.Message = GlobalMessages.ForbiddenAccess;
break;
default:
response.StatusCode = (int)HttpStatusCode.InternalServerError;
responseModel.Status = (int)HttpStatusCode.InternalServerError;
responseModel.Message = GlobalMessages.ExceptionOccured;
break;

View file

@ -1,17 +1,16 @@
using BMA.EHR.Application.Common.Interfaces;
using BMA.EHR.Domain.Models.Commands.Core;
using BMA.EHR.Domain.Models.Documents;
using BMA.EHR.Domain.Models.HR;
using BMA.EHR.Domain.Models.Insignias;
using BMA.EHR.Domain.Models.MetaData;
using BMA.EHR.Domain.Models.OrganizationEmployee;
using BMA.EHR.Domain.Models.Notifications;
using BMA.EHR.Domain.Models.OrganizationEmployee;
using BMA.EHR.Domain.Models.Organizations;
using BMA.EHR.Domain.Models.Organizations.Report2;
using BMA.EHR.Domain.Models.Placement;
using Microsoft.EntityFrameworkCore;
using BMA.EHR.Domain.Models.Commands.Core;
using BMA.EHR.Domain.Models.Commands;
using BMA.EHR.Domain.Models.Insignias;
using BMA.EHR.Domain.Models.Retirement;
using Microsoft.EntityFrameworkCore;
namespace BMA.EHR.Infrastructure.Persistence
{