I created a CrudAppService. When I invoke its dynamic API by using swagger, I get a generic 500
error with this description:
If you use CurrentUnitOfWork
, you can catch the exception also and using
UserFriendlyException
you can throw the desired exception. UserFriendlyException
is a specific type of exception so ABP directly shows exception message to the end user.
Example:
try
{
await _repository.InsertAsync(...);
await CurrentUnitOfWork.SaveChangesAsync();
}
catch(Exception ex)
{
throw new UserFriendlyException("user friendly exception message");
}