For this, you can create a method in MyProjectNamePageModel
as follows.
protected void ShowAlert(Exception exception)
{
Logger.LogException(exception);
var errorInfoConverter = LazyServiceProvider.LazyGetRequiredService<IExceptionToErrorInfoConverter>();
var errorInfo = errorInfoConverter.Convert(exception, options =>
{
options.SendExceptionsDetailsToClients = false;
options.SendStackTraceToClients = false;
});
Alerts.Danger(errorInfo.Message);
}
}
Source: https://github.com/abpframework/eventhub/blob/main/src/EventHub.Web/Pages/EventHubPageModel.cs#L16-L27
Then update your relevant page model to inherit from MyProjectNamePageModel
. Finally, you can catch the error with the try-catch block below and show it in UI.
try
{
// ...
// ...
return RedirectToPage("./Profile", new {name = organization.Name});
}
catch (Exception exception)
{
ShowAlert(exception); // this line
return Page();
}
Source: https://github.com/abpframework/eventhub/blob/main/src/EventHub.Web/Pages/Organizations/New.cshtml.cs#L36-L60
Can you run the following commands in order in the directory where the solution is located?
abp clean
dotnet build /graphBuild
Thanks for the report. I'll test the situation as soon as possible.
My recommendation is to use page alerts
for this situation. Showing modals in get
requests is not a good practice in terms of UX
because it makes the user feel as if there is a problem with the system.
https://docs.abp.io/en/abp/latest/UI/AspNetCore/Page-Alerts#basic-usage
Thank you for your detailed explanation. I understood the problem and I talked to the team about the problem, I learned that there is a breaking change for v5.0.0
.
You can see the details of the issue here: https://github.com/abpframework/abp/issues/9926
Then I added the marked code in the picture below to test the situation, and it worked fine when I made a request via swagger.
However breaks MVC pages and abp's js proxy scripts, which use ajax.
We discuss inside to find the most optimal solution to this problem.
Hello, I tried to reproduce the problem but unfortunately, I couldn't reproduce it. There is no need to repeat what has been said in other tickets, so if you can provide a minimally reproducible example, we will be able to better detect and solve the problem.
Closing the question. Feel free to re-open if the problem is not resolved.
Closing the question. Feel free to create a new issue if you have further questions.
Problem solved, can you try again?