-
Notifications
You must be signed in to change notification settings - Fork 4.6k
/
CertificateOperationError.cs
58 lines (49 loc) · 1.87 KB
/
CertificateOperationError.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
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
using System.Text.Json;
namespace Azure.Security.KeyVault.Certificates
{
/// <summary>
/// An error encountered during the processing of a <see cref="CertificateOperation"/>.
/// </summary>
public class CertificateOperationError : IJsonDeserializable
{
private const string CodePropertyName = "code";
private const string MessagePropertyName = "message";
private const string InnerErrorPropertyName = "innererror";
internal CertificateOperationError()
{
}
/// <summary>
/// Gets the error code of the specified error.
/// </summary>
public string Code { get; internal set; }
/// <summary>
/// Gets a message containing details of the encountered error.
/// </summary>
public string Message { get; internal set; }
/// <summary>
/// Gets an underlying error - if one exists - for the current error.
/// </summary>
public CertificateOperationError InnerError { get; internal set; }
void IJsonDeserializable.ReadProperties(JsonElement json)
{
foreach (JsonProperty prop in json.EnumerateObject())
{
switch (prop.Name)
{
case CodePropertyName:
Code = prop.Value.GetString();
break;
case MessagePropertyName:
Message = prop.Value.GetString();
break;
case InnerErrorPropertyName:
InnerError = new CertificateOperationError();
((IJsonDeserializable)InnerError).ReadProperties(prop.Value);
break;
}
}
}
}
}