Beispiel #1
0
        /// <inheritdoc />
        protected override Task <Exception> GetDefaultException(
            RequestContent requestContent,
            ResponseContent responseContent,
            HttpResponseExceptionContext context)
        {
            var stringBuilder = new StringBuilder();

            stringBuilder.AppendLine("There was an unexpected response.");
            stringBuilder.AppendLine("Response:");
            stringBuilder.AppendLine(responseContent.ToString());
            stringBuilder.AppendLine("Request:");
            stringBuilder.AppendLine(requestContent.ToString());

            var exceptionMessage = context.Formatter.Message(stringBuilder.ToString());

            return(Task.FromResult(new Exception(exceptionMessage)));
        }
Beispiel #2
0
 /// <summary>
 /// Gets the default exception.
 /// </summary>
 /// <param name="requestContent">Content of the request.</param>
 /// <param name="responseContent">Content of the response.</param>
 /// <param name="context">The context.</param>
 /// <returns>The default exception.</returns>
 protected abstract Task <Exception> GetDefaultException(
     RequestContent requestContent,
     ResponseContent responseContent,
     HttpResponseExceptionContext context);