| | | 1 | | // Licensed to the .NET Foundation under one or more agreements. |
| | | 2 | | // The .NET Foundation licenses this file to you under the MIT license. |
| | | 3 | | |
| | | 4 | | using System.IO; |
| | | 5 | | |
| | | 6 | | namespace System.Net.Http |
| | | 7 | | { |
| | | 8 | | /// <summary> |
| | | 9 | | /// An exception thrown when an error occurs while reading the response. |
| | | 10 | | /// </summary> |
| | | 11 | | public class HttpIOException : IOException |
| | | 12 | | { |
| | | 13 | | /// <summary> |
| | | 14 | | /// Initializes a new instance of the <see cref="HttpIOException"/> class. |
| | | 15 | | /// </summary> |
| | | 16 | | /// <param name="httpRequestError">The <see cref="Http.HttpRequestError"/> that caused the exception.</param> |
| | | 17 | | /// <param name="message">The message string describing the error.</param> |
| | | 18 | | /// <param name="innerException">The exception that is the cause of the current exception.</param> |
| | | 19 | | public HttpIOException(HttpRequestError httpRequestError, string? message = null, Exception? innerException = nu |
| | 0 | 20 | | : base(message, innerException) |
| | 0 | 21 | | { |
| | 0 | 22 | | HttpRequestError = httpRequestError; |
| | 0 | 23 | | } |
| | | 24 | | |
| | | 25 | | /// <summary> |
| | | 26 | | /// Gets the <see cref="Http.HttpRequestError"/> that caused the exception. |
| | | 27 | | /// </summary> |
| | 0 | 28 | | public HttpRequestError HttpRequestError { get; } |
| | | 29 | | |
| | | 30 | | /// <inheritdoc /> |
| | 0 | 31 | | public override string Message => $"{base.Message} ({HttpRequestError})"; |
| | | 32 | | } |
| | | 33 | | } |