|
|
|
@ -1,6 +1,7 @@ |
|
|
|
using System; |
|
|
|
using Microsoft.Extensions.Logging; |
|
|
|
using Microsoft.Extensions.Logging.Abstractions; |
|
|
|
using Microsoft.Extensions.Options; |
|
|
|
using Volo.Abp.AspNetCore.Components.Messages; |
|
|
|
using Volo.Abp.AspNetCore.ExceptionHandling; |
|
|
|
using Volo.Abp.DependencyInjection; |
|
|
|
@ -15,12 +16,16 @@ namespace Volo.Abp.AspNetCore.Components.WebAssembly.ExceptionHandling |
|
|
|
protected IUiMessageService MessageService { get; } |
|
|
|
protected IExceptionToErrorInfoConverter ExceptionToErrorInfoConverter { get; } |
|
|
|
|
|
|
|
protected AbpExceptionHandlingOptions Options { get; } |
|
|
|
|
|
|
|
public UserExceptionInformer( |
|
|
|
IUiMessageService messageService, |
|
|
|
IExceptionToErrorInfoConverter exceptionToErrorInfoConverter) |
|
|
|
IExceptionToErrorInfoConverter exceptionToErrorInfoConverter, |
|
|
|
IOptions<AbpExceptionHandlingOptions> options) |
|
|
|
{ |
|
|
|
MessageService = messageService; |
|
|
|
ExceptionToErrorInfoConverter = exceptionToErrorInfoConverter; |
|
|
|
Options = options.Value; |
|
|
|
Logger = NullLogger<UserExceptionInformer>.Instance; |
|
|
|
} |
|
|
|
|
|
|
|
@ -41,12 +46,7 @@ namespace Volo.Abp.AspNetCore.Components.WebAssembly.ExceptionHandling |
|
|
|
|
|
|
|
protected virtual RemoteServiceErrorInfo GetErrorInfo(UserExceptionInformerContext context) |
|
|
|
{ |
|
|
|
if (context.Exception is AbpRemoteCallException remoteCallException) |
|
|
|
{ |
|
|
|
return remoteCallException.Error; |
|
|
|
} |
|
|
|
|
|
|
|
return ExceptionToErrorInfoConverter.Convert(context.Exception, false); |
|
|
|
return ExceptionToErrorInfoConverter.Convert(context.Exception, Options.SendExceptionsDetailsToClients); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|