forked from Azure-Samples/cognitive-services-speech-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
failed_http_client_request_exception.cs
59 lines (49 loc) · 1.7 KB
/
failed_http_client_request_exception.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE.md file in the project root for full license information.
//
namespace BatchClient
{
using System;
using System.Net;
using System.Runtime.Serialization;
[Serializable]
public sealed class FailedHttpClientRequestException : Exception
{
public FailedHttpClientRequestException()
{
this.StatusCode = HttpStatusCode.Unused;
}
public FailedHttpClientRequestException(string message)
: base(message)
{
this.StatusCode = HttpStatusCode.Unused;
}
public FailedHttpClientRequestException(string message, Exception exception)
: base(message, exception)
{
this.StatusCode = HttpStatusCode.Unused;
}
public FailedHttpClientRequestException(HttpStatusCode status, string reasonPhrase)
: base(reasonPhrase)
{
this.StatusCode = status;
}
private FailedHttpClientRequestException(SerializationInfo info, StreamingContext context)
: base(info, context)
{
this.StatusCode = (HttpStatusCode)info.GetValue(nameof(this.StatusCode), typeof(HttpStatusCode));
}
public HttpStatusCode StatusCode { get; private set; }
public string ReasonPhrase => this.Message;
/// <inheritdoc />
public override void GetObjectData(SerializationInfo info, StreamingContext context)
{
if (info != null)
{
info.AddValue(nameof(this.StatusCode), this.StatusCode);
}
base.GetObjectData(info, context);
}
}
}