abpframework / abp

Open-source web application framework for ASP.NET Core! Offers an opinionated architecture to build enterprise software solutions with best practices on top of the .NET. Provides the fundamental infrastructure, cross-cutting-concern implementations, startup templates, application modules, UI themes, tooling and documentation.
https://abp.io
GNU Lesser General Public License v3.0
12.78k stars 3.41k forks source link

BusinessException shown condition not mention in documentation #10078

Closed puschie286 closed 2 years ago

puschie286 commented 3 years ago

original issue was closed due non related anwser please read the description! https://github.com/abpframework/abp/issues/10050

gterdem commented 3 years ago

You need to use try catch block in your app service to catch your Business Exception then throw UserFriendly Exception with the cought data as you like.

Why? Because business rules (referring to domain rules and their exceptions) are independent from application service and UI. Your Code 101 Business Exception may have unnecessary information for mobile UI but you may want to show detailed info for Web UI. So you need to catch the exception and throw different UserFriendly exceptions in different app services for the same business exception.

puschie286 commented 3 years ago

well there are some conditions to show it without userfriendlyexception

BuisnessExceptions are automaticly shown if your ErrorCode starts with your resource/project name. https://github.com/abpframework/abp/blob/12677fb2307d1b48451bf991f8a86092847de9cd/framework/src/Volo.Abp.ExceptionHandling/Volo/Abp/AspNetCore/ExceptionHandling/DefaultExceptionToErrorInfoConverter.cs#L135-L141

and the question of this Issue is to put this information into the documentation - everything works, but documentation miss this information

stale[bot] commented 2 years ago

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.