-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
Angular not catching error returned from UserFriendlyException #19852
Comments
Hi, can you provide an example project? |
Hi @Sinan997 please find the minimal reproduceable code in this project: https://github.com/zachhongcy/Acme.BookStore I tested it again and the issue still persists with ABP v8.1.3. I have a simple BookAppService that throws the |
Hello, @zachhongcy. For your case, the error response object is reflected like this:
For this reason, the block where we look for the error message would not work.
You may try customizing the related part as follows:
or you can directly use |
Is there an existing issue for this?
Description
Hi I'm facing an issue where Angular HTTP error handling as suggested by ABP in https://docs.abp.io/en/abp/latest/UI/Angular/HTTP-Error-Handling does not catch
UserFriendlyException
thrown by .NET backend server.Any help or advice would be appreciated, thanks!
Reproduction Steps
Throwing
UserFriendlyException
in C#, e.g.ProductStockInAppService
Catching the error in Angular using
CustomHttpErrorHandlerService
Toast the error message with status code
Expected behavior
Angular
CustomHttpErrorHandlerService
should be able to capture response body that's identical to what is produced by swagger UI:Actual behavior
error.error
is undefined when shown in log:ToasterService does not show error message, but with the correct status code:
Regression?
No response
Known Workarounds
No response
Version
8.1
User Interface
Angular
Database Provider
EF Core (Default)
Tiered or separate authentication server
Tiered
Operation System
Windows (Default)
Other information
I had also configured
AbpExceptionHandlingOptions
in ApplicationService module to send exception details to clients:ApplicationModule.cs
The text was updated successfully, but these errors were encountered: