Skip to content
This repository was archived by the owner on Feb 27, 2024. It is now read-only.

Commit 0c8614c

Browse files
committed
Add implementation of HttpRequestException
1 parent 83bec26 commit 0c8614c

3 files changed

Lines changed: 49 additions & 1 deletion

File tree

Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<Project>
22
<PropertyGroup>
3-
<Version>3.7.0</Version>
3+
<Version>3.8.0</Version>
44
</PropertyGroup>
55

66
<PropertyGroup>
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
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+
}

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ Example:
7171
<Using Include="JustArchiNET.Madness.FileMadness.File" Alias="File" />
7272
<Using Include="JustArchiNET.Madness.HashCodeMadness.HashCode" Alias="HashCode" />
7373
<Using Include="JustArchiNET.Madness.HMACSHA1Madness.HMACSHA1" Alias="HMACSHA1" />
74+
<Using Include="JustArchiNET.Madness.HttpRequestExceptionMadness.HttpRequestException" Alias="HttpRequestException" />
7475
<Using Include="JustArchiNET.Madness.OperatingSystemMadness.OperatingSystem" Alias="OperatingSystem" />
7576
<Using Include="JustArchiNET.Madness.PathMadness.Path" Alias="Path" />
7677
<Using Include="JustArchiNET.Madness.RandomMadness.Random" Alias="Random" />

0 commit comments

Comments
 (0)