public async Task <IActionResult> Error(string?errorId = null) { await SignInManager.SignOutAsync(); var vm = new ErrorVM(); var response = HttpContext.GetOpenIddictServerResponse(); vm.ErrorMessage = response?.ErrorDescription; vm.ErrorCode = response?.Error; if (string.IsNullOrWhiteSpace(vm.ErrorMessage)) { var exception = HttpContext.Features.Get <IExceptionHandlerFeature>()?.Error; if (exception is DomainException domainException1) { vm.ErrorMessage = domainException1.Message; } else if (exception?.InnerException is DomainException domainException2) { vm.ErrorMessage = domainException2.Message; } } return(View("Error", vm)); }
public async Task <IActionResult> Error(string?errorId = null) { await SignInManager.SignOutAsync(); var vm = new ErrorVM(); if (!string.IsNullOrWhiteSpace(errorId)) { var message = await interaction.GetErrorContextAsync(errorId); if (message != null) { vm.Error = message; } } if (vm.Error == null) { var error = HttpContext.Features.Get <IExceptionHandlerFeature>()?.Error; if (error is DomainException exception) { vm.Error = new ErrorMessage { ErrorDescription = exception.Message }; } else if (error?.InnerException is DomainException exception2) { vm.Error = new ErrorMessage { ErrorDescription = exception2.Message }; } } return(View("Error", vm)); }