Base solution for your next web application
Open Closed

How to have custom exception response for a specific execption (Microsoft.EntityFrameworkCore.DbUpdateException) #8284


User avatar
0
adamphones created

What we would like is to be able to send friendly message back to client for all Microsoft.EntityFrameworkCore.DbUpdateException instead of sending back 500 invalid exception message : "An error occurred while updating the entries. See the inner exception for details."


2 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team

    You can try to implement your custom IExceptionToErrorInfoConverter to handle exception information.

    https://github.com/aspnetboilerplate/aspnetboilerplate/blob/dev/src/Abp.Web.Common/Web/Models/DefaultErrorInfoConverter.cs#L16

    You can also customize StatusCode.

    https://github.com/aspnetboilerplate/aspnetboilerplate/blob/dev/src/Abp.AspNetCore/AspNetCore/Mvc/ExceptionHandling/AbpExceptionFilter.cs#L85

  • User Avatar
    0
    ismcagdas created
    Support Team

    This issue is closed because of no recent activity. Please open a new issue if you are still having this problem.