|
| 1 | +// _ __ __ |
| 2 | +// ___ ___ ___ _ __ __| | __ _ | \/ | |
| 3 | +// / __|/ __| / _ \| '_ \ / _` | / _` || |\/| | |
| 4 | +// \__ \\__ \| __/| | | || (_| || (_| || | | | |
| 5 | +// |___/|___/ \___||_| |_| \__,_| \__,_||_| |_| |
| 6 | +// | |
| 7 | +// Copyright 2021-2022 Łukasz "JustArchi" Domeradzki |
| 8 | +// Contact: JustArchi@JustArchi.net |
| 9 | +// | |
| 10 | +// Licensed under the Apache License, Version 2.0 (the "License"); |
| 11 | +// you may not use this file except in compliance with the License. |
| 12 | +// You may obtain a copy of the License at |
| 13 | +// | |
| 14 | +// http://www.apache.org/licenses/LICENSE-2.0 |
| 15 | +// | |
| 16 | +// Unless required by applicable law or agreed to in writing, software |
| 17 | +// distributed under the License is distributed on an "AS IS" BASIS, |
| 18 | +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 19 | +// See the License for the specific language governing permissions and |
| 20 | +// limitations under the License. |
| 21 | + |
| 22 | +using System; |
| 23 | +using System.Net; |
| 24 | +using JetBrains.Annotations; |
| 25 | +using JustArchiNET.Madness.Helpers; |
| 26 | + |
| 27 | +namespace JustArchiNET.Madness.HttpRequestExceptionMadness; |
| 28 | + |
| 29 | +[MadnessType(EMadnessType.Replacement)] |
| 30 | +[PublicAPI] |
| 31 | +public class HttpRequestException : System.Net.Http.HttpRequestException { |
| 32 | + /// <summary> |
| 33 | + /// Gets the HTTP status code to be returned with the exception. |
| 34 | + /// </summary> |
| 35 | + /// <value> |
| 36 | + /// An HTTP status code if the exception represents a non-successful result, otherwise <c>null</c>. |
| 37 | + /// </value> |
| 38 | + public HttpStatusCode? StatusCode { get; } |
| 39 | + |
| 40 | + public HttpRequestException() { } |
| 41 | + |
| 42 | + public HttpRequestException(string? message) : base(message) { } |
| 43 | + |
| 44 | + public HttpRequestException(string? message, Exception? inner) : base(message, inner) { } |
| 45 | + |
| 46 | + public HttpRequestException(string? message, Exception? inner, HttpStatusCode? statusCode) : this(message, inner) => StatusCode = statusCode; |
| 47 | +} |
0 commit comments