Skip to content

Commit

Permalink
Revert "#117 Implementation of graceful timeout exception"
Browse files Browse the repository at this point in the history
This reverts commit 4fb00e6.
  • Loading branch information
Jonny Rylands committed Jan 28, 2021
1 parent 4fb00e6 commit 20931c7
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 17 deletions.
1 change: 0 additions & 1 deletion source/gpconnect-appointment-checker/Models/SearchModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,5 @@ public partial class SearchModel
public string ProviderErrorDiagnostics { get; set; }
public int? SearchResultsCount { get; set; }
public bool LdapErrorRaised { get; set; }
public bool TimeoutErrorRaised { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,4 @@ else if (Model.LdapErrorRaised)
</div>
</div>
</div>
}
else if (Model.TimeoutErrorRaised)
{
<div class="nhsuk-grid-row">
<div class="nhsuk-grid-column-full">
<div class="nhsuk-warning-callout">
<h3 class="nhsuk-warning-callout__label">@SearchConstants.ISSUEWITHTIMEOUTTITLETEXT</h3>
<p>@SearchConstants.ISSUEWITHTIMEOUTTEXT</p>
</div>
</div>
</div>
}
Original file line number Diff line number Diff line change
Expand Up @@ -140,11 +140,6 @@ private async Task GetSearchResults()
LdapErrorRaised = true;
_auditSearchIssues.Add(SearchConstants.ISSUEWITHLDAPTEXT);
}
catch (TimeoutException)
{
TimeoutErrorRaised = true;
_auditSearchIssues.Add(SearchConstants.ISSUEWITHTIMEOUTTEXT);
}
}

private async Task PopulateSearchResults(Spine providerGpConnectDetails, Organisation providerOrganisationDetails,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
@page
@using gpconnect_appointment_checker.Helpers.Constants
@model gpconnect_appointment_checker.Pages.ErrorModel
@addTagHelper *, gpconnect-appointment-checker

<div class="nhsuk-grid-row">
<div class="nhsuk-grid-column-two-thirds">
<div class="nhsuk-error-summary" aria-labelledby="error-summary-title" role="alert" tabindex="-1">
<h2 class="nhsuk-error-summary__title" id="error-summary-title">@SearchConstants.ISSUEWITHTIMEOUTTITLETEXT</h2>
<div class="nhsuk-error-summary__body">
<span class="nhsuk-error-message">
<span class="nhsuk-u-visually-hidden">Error:</span> @SearchConstants.ISSUEWITHTIMEOUTTEXT
</span>
</div>
</div>
<div class="nhsuk-action-link">
<a class="nhsuk-action-link__link" href="/Search">
<svg class="nhsuk-icon nhsuk-icon__arrow-right-circle" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" aria-hidden="true">
<path d="M0 0h24v24H0z" fill="none"></path>
<path d="M12 2a10 10 0 0 0-9.95 9h11.64L9.74 7.05a1 1 0 0 1 1.41-1.41l5.66 5.65a1 1 0 0 1 0 1.42l-5.66 5.65a1 1 0 0 1-1.41 0 1 1 0 0 1 0-1.41L13.69 13H2.05A10 10 0 1 0 12 2z"></path>
</svg>
<span class="nhsuk-action-link__text">@SearchConstants.RETURNTOSEARCHPAGETEXT</span>
</a>
</div>
</div>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
using gpconnect_appointment_checker.SDS.Interfaces;
using Microsoft.AspNetCore.Diagnostics;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
using System.Diagnostics;

namespace gpconnect_appointment_checker.Pages
{
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
public class TimeoutErrorModel : PageModel
{
protected ILogger<TimeoutErrorModel> _logger;

public TimeoutErrorModel(IConfiguration configuration, IHttpContextAccessor contextAccessor, ILogger<TimeoutErrorModel> logger, ILdapService ldapService)
{
_logger = logger;
}

public string RequestId { get; set; }
public string ExceptionMessage { get; set; }

public void OnGet()
{
RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier;
var exceptionHandlerPathFeature =
HttpContext.Features.Get<IExceptionHandlerPathFeature>();
_logger.LogError($"Timeout error thrown at {exceptionHandlerPathFeature?.Path} - ", exceptionHandlerPathFeature?.Error.InnerException);
}
}
}

0 comments on commit 20931c7

Please sign in to comment.