public async Task <ActionResult <LineItem> > GetLineItemAsync([Required] string contextId, [Required] string lineItemId) { try { _logger.LogDebug($"Entering {nameof(GetLineItemAsync)}."); try { var request = new GetLineItemRequest(contextId, lineItemId); return(await OnGetLineItemAsync(request).ConfigureAwait(false)); } catch (Exception ex) { _logger.LogError(ex, $"An unexpected error occurred in {nameof(GetLineItemAsync)}."); return(StatusCode(StatusCodes.Status500InternalServerError, new ProblemDetails { Title = "An unexpected error occurred", Status = StatusCodes.Status500InternalServerError, Detail = _env.IsDevelopment() ? ex.Message + ex.StackTrace : ex.Message })); } } finally { _logger.LogDebug($"Exiting {nameof(GetLineItemAsync)}."); } }
/// <summary> /// Get a line item. /// </summary> /// <param name="request">The request parameters.</param> /// <returns>The line item.</returns> protected abstract Task <ActionResult <LineItem> > OnGetLineItemAsync(GetLineItemRequest request);