-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Closed
Description
I'm using ABP 9.3, and I want to show custom error messages with the stack trace and details message for Test environment only
So I set up the configuration in the host module like this:
Configure<AbpExceptionHandlingOptions>(options =>
{
var returnExceptionDetails =
Convert.ToBoolean(configuration["App:Features:AllowReturningExceptionDetailsToClient"]);
options.SendExceptionsDetailsToClients = returnExceptionDetails;
options.SendStackTraceToClients = returnExceptionDetails;
});
I have a custom override for DefaultExceptionToErrorInfoConverter
public class CustomExceptionToErrorConverter(
IOptions<AbpExceptionLocalizationOptions> localizationOptions,
IStringLocalizerFactory stringLocalizerFactory,
IStringLocalizer<AbpExceptionHandlingResource> stringLocalizer,
IServiceProvider serviceProvider)
: DefaultExceptionToErrorInfoConverter(
localizationOptions,
stringLocalizerFactory,
stringLocalizer,
serviceProvider)
{
protected override RemoteServiceErrorInfo CreateErrorInfoWithoutCode(Exception exception,
AbpExceptionHandlingOptions options)
{
var sendExceptionsDetailsToClients = options.SendExceptionsDetailsToClients; // always false
var sendStackTraceToClients = options.SendStackTraceToClients; // always ture
// rest of the code
}
}
Related code:
Line 326 in ed24991
| protected virtual AbpExceptionHandlingOptions CreateDefaultOptions() |
I have to make a temporary solution by injecting IOptions<AbpExceptionHandlingOptions> exceptionHandlingOptions, but I hope this could be fixed in future releases
Thanks