Browse Source

Made error handling work (initial)

pull/8074/head
Halil İbrahim Kalkan 5 years ago
parent
commit
b17eb8e9cd
  1. 1
      framework/src/Volo.Abp.AspNetCore.Components.Web/Volo/Abp/AspNetCore/Components/Web/ExceptionHandling/AbpExceptionHandlingLogger.cs
  2. 2
      framework/src/Volo.Abp.AspNetCore.Components.Web/Volo/Abp/AspNetCore/Components/Web/ExceptionHandling/UserExceptionInformer.cs
  3. 2
      framework/src/Volo.Abp.AspNetCore.Components/Volo/Abp/AspNetCore/Components/AbpComponentBase.cs
  4. 13
      framework/src/Volo.Abp.BlazoriseUI/AbpCrudPageBase.cs
  5. 19
      modules/identity/src/Volo.Abp.Identity.Blazor/Pages/Identity/RoleManagement.razor.cs

1
framework/src/Volo.Abp.AspNetCore.Components.Web/Volo/Abp/AspNetCore/Components/Web/ExceptionHandling/AbpExceptionHandlingLogger.cs

@ -1,6 +1,7 @@
using System;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Volo.Abp.AspNetCore.Components.ExceptionHandling;
namespace Volo.Abp.AspNetCore.Components.Web.ExceptionHandling
{

2
framework/src/Volo.Abp.AspNetCore.Components.Web/Volo/Abp/AspNetCore/Components/Web/ExceptionHandling/UserExceptionInformer.cs

@ -11,7 +11,7 @@ using Volo.Abp.Http;
namespace Volo.Abp.AspNetCore.Components.Web.ExceptionHandling
{
[Dependency(ReplaceServices = true)]
public class UserExceptionInformer : IUserExceptionInformer, ITransientDependency
public class UserExceptionInformer : IUserExceptionInformer, IScopedDependency
{
public ILogger<UserExceptionInformer> Logger { get; set; }
protected IUiMessageService MessageService { get; }

2
framework/src/Volo.Abp.AspNetCore.Components/Volo/Abp/AspNetCore/Components/AbpComponentBase.cs

@ -64,7 +64,7 @@ namespace Volo.Abp.AspNetCore.Components
protected IUiNotificationService Notify => LazyGetNonScopedRequiredService(ref _notify);
private IUiNotificationService _notify;
protected IUserExceptionInformer UserExceptionInformer => LazyGetRequiredService(ref _userExceptionInformer);
protected IUserExceptionInformer UserExceptionInformer => LazyGetNonScopedRequiredService(ref _userExceptionInformer);
private IUserExceptionInformer _userExceptionInformer;
protected IAlertManager AlertManager => LazyGetNonScopedRequiredService(ref _alertManager);

13
framework/src/Volo.Abp.BlazoriseUI/AbpCrudPageBase.cs

@ -412,10 +412,17 @@ namespace Volo.Abp.BlazoriseUI
protected virtual async Task DeleteEntityAsync(TListViewModel entity)
{
await CheckDeletePolicyAsync();
try
{
await CheckDeletePolicyAsync();
await AppService.DeleteAsync(entity.Id);
await GetEntitiesAsync();
await AppService.DeleteAsync(entity.Id);
await GetEntitiesAsync();
}
catch (Exception ex)
{
await ShowError(ex);
}
}
protected virtual string GetDeleteConfirmationMessage(TListViewModel entity)

19
modules/identity/src/Volo.Abp.Identity.Blazor/Pages/Identity/RoleManagement.razor.cs

@ -1,6 +1,4 @@
using System;
using System.Threading.Tasks;
using Blazorise;
using Microsoft.AspNetCore.Authorization;
using Volo.Abp.Identity.Localization;
using Volo.Abp.PermissionManagement.Blazor.Components;
@ -35,23 +33,6 @@ namespace Volo.Abp.Identity.Blazor.Pages.Identity
HasManagePermissionsPermission = await AuthorizationService.IsGrantedAsync(IdentityPermissions.Roles.ManagePermissions);
}
protected override async Task DeleteEntityAsync(IdentityRoleDto entity)
{
//TODO: I will move try/catch to base class, doing here for test purpose
try
{
await CheckDeletePolicyAsync();
await AppService.DeleteAsync(entity.Id);
await GetEntitiesAsync();
}
catch (Exception ex)
{
await ShowError(ex);
//await Message.Error("Error: " + ex.Message); //This works if I uncomment
}
}
protected override string GetDeleteConfirmationMessage(IdentityRoleDto entity)
{
return string.Format(L["RoleDeletionConfirmationMessage"], entity.Name);

Loading…
Cancel
Save