From 88674d00b65d7cb843f73ea4496d8a6cebc36e53 Mon Sep 17 00:00:00 2001 From: mahajan-xor <141996067+mahajan-xor@users.noreply.github.com> Date: Thu, 30 Nov 2023 10:25:46 +0530 Subject: [PATCH] Adds exception block for handling unauthorized exception (#3604) * Adds extra exception block for handling unauthorized exception * warning messaged changed * warning message updated * commited once again --- .../Features/Operations/Import/ImportProcessingJob.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/Microsoft.Health.Fhir.SqlServer/Features/Operations/Import/ImportProcessingJob.cs b/src/Microsoft.Health.Fhir.SqlServer/Features/Operations/Import/ImportProcessingJob.cs index 539197b187..4098c6bcff 100644 --- a/src/Microsoft.Health.Fhir.SqlServer/Features/Operations/Import/ImportProcessingJob.cs +++ b/src/Microsoft.Health.Fhir.SqlServer/Features/Operations/Import/ImportProcessingJob.cs @@ -8,6 +8,7 @@ using System.Threading; using System.Threading.Channels; using System.Threading.Tasks; +using Azure; using EnsureThat; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Primitives; @@ -111,6 +112,12 @@ public async Task ExecuteAsync(JobInfo jobInfo, IProgress progre { throw; } + catch (RequestFailedException ex) when (ex.Status == 403) + { + _logger.LogInformation(ex, "Due to unauthorized request, import processing operation failed."); + var error = new ImportProcessingJobErrorResult() { Message = "Due to unauthorized request, import processing operation failed." }; + throw new JobExecutionException(ex.Message, error, ex); + } catch (Exception ex) { _logger.LogError(ex, "Failed to load data.");