Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception details in ABP framework #6879

Closed
slm-w opened this issue Dec 29, 2020 · 7 comments · Fixed by #8001
Closed

Exception details in ABP framework #6879

slm-w opened this issue Dec 29, 2020 · 7 comments · Fixed by #8001

Comments

@slm-w
Copy link

slm-w commented Dec 29, 2020

I wanna return the details of exception for users,for example a user can't delete a given parent row if a child row exists,i changed the parameter in database cascade to restrict but i get a a pop up without the type of exception how can i generate the details of exceptions for users.
Thank You

@cristiandmonda
Copy link

You can create a custom exception, there's an example in the tutorial and more information in the exception handling section of the documentation

@slm-w
Copy link
Author

slm-w commented Dec 30, 2020

@cristiandmonda thanks for your feedback,i have already used abp exception, I use this function to generate exception message if the user want delete a foreign key already in use but it doesn't work,i got just a error message without details
[Authorize(SocietePermissions.Villes.Delete)]
public async Task DeleteAsync(Guid id)
{
try
{
await _villeRepository.DeleteAsync(id);
}
catch (DbUpdateException)
{

            throw
                  new UserFriendlyException(
                    "Item Cannot be deleted"

          );
        } ;

image

@slm-w
Copy link
Author

slm-w commented Jan 5, 2021

@maliming

@stale
Copy link

stale bot commented Mar 7, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the inactive label Mar 7, 2021
@lanpin
Copy link
Contributor

lanpin commented Mar 8, 2021

@realLiangshiwei This problem still exists.

@stale stale bot removed the inactive label Mar 8, 2021
@realLiangshiwei
Copy link
Member

@lanpin

  • Your ABP Framework version.
  • Your User Interface type (Angular/MVC/React... etc.) if the issue is related to a specific UI
  • Your database provider(EF Core/MongoDB)
  • Exception message and stack trace if available (check the logs).
  • Steps needed to reproduce the problem.

@lanpin
Copy link
Contributor

lanpin commented Mar 9, 2021

@realLiangshiwei
run microservice-pro
add this code to ProductAppService.cs

and you see:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants