/// <summary>
        /// Extracts the requestId from an ApiException
        /// </summary>
        public static string GetRequestId(this ApiException ex)
        {
            if (ex.ProblemDetails() == null)
            {
                return(null);
            }

            // Extract requestId from Insights link contained in the Instance property
            var instanceParts = ex.ProblemDetails().Instance.Split("/".ToCharArray());

            return(instanceParts.Length < 7 ? null : instanceParts[6]);
        }
Exemple #2
0
        public void ApiException_With_Empty_ErrorContent_Returns_Null()
        {
            var error         = new ApiException();
            var errorResponse = error.ProblemDetails();

            Assert.That(errorResponse, Is.Null);
        }