Skip to content

Commit fe5b728

Browse files
authored
Add API description for Azure PowerShell exceptions. (#246)
1 parent 8717aad commit fe5b728

12 files changed

+468
-2
lines changed

src/Common/Exceptions/AzPSApplicationException.cs

+32
Original file line numberDiff line numberDiff line change
@@ -18,32 +18,55 @@
1818

1919
namespace Microsoft.Azure.Commands.Common.Exceptions
2020
{
21+
/// <summary>
22+
/// Representive of ApplicationException in Azure PowerShell.
23+
/// </summary>
2124
public class AzPSApplicationException : ApplicationException, IContainsAzPSErrorData
2225
{
26+
/// <summary>
27+
/// ErrorKind that causes this exception.
28+
/// </summary>
2329
public ErrorKind ErrorKind
2430
{
2531
get => Data.GetValue<ErrorKind>(AzurePSErrorDataKeys.ErrorKindKey);
2632
private set => Data.SetValue(AzurePSErrorDataKeys.ErrorKindKey, value);
2733
}
2834

35+
/// <summary>
36+
/// The error message which doesn't contain PII.
37+
/// </summary>
2938
public string DesensitizedErrorMessage
3039
{
3140
get => Data.GetValue<string>(AzurePSErrorDataKeys.DesensitizedErrorMessageKey);
3241
private set => Data.SetValue(AzurePSErrorDataKeys.DesensitizedErrorMessageKey, value);
3342
}
3443

44+
/// <summary>
45+
/// The number of line when exception happens.
46+
/// </summary>
3547
public int? ErrorLineNumber
3648
{
3749
get => Data.GetNullableValue<int>(AzurePSErrorDataKeys.ErrorLineNumberKey);
3850
private set => Data.SetValue(AzurePSErrorDataKeys.ErrorLineNumberKey, value);
3951
}
4052

53+
/// <summary>
54+
/// The file name when exception happens.
55+
/// </summary>
4156
public string ErrorFileName
4257
{
4358
get => Data.GetValue<string>(AzurePSErrorDataKeys.ErrorFileNameKey);
4459
private set => Data.SetValue(AzurePSErrorDataKeys.ErrorFileNameKey, value);
4560
}
4661

62+
/// <summary>
63+
/// Construtor of AzPSApplicationException
64+
/// </summary>
65+
/// <param name="message">The error message that explains the reason for the exception.</param>
66+
/// <param name="innerException">The exception that is the cause of the current exception. Default value is null.</param>
67+
/// <param name="desensitizedMessage">The error message which doesn't contain PII.</param>
68+
/// <param name="lineNumber">The number of line when exception happens.</param>
69+
/// <param name="filePath">The file path when exception happens.</param>
4770
public AzPSApplicationException(
4871
string message,
4972
Exception innerException = null,
@@ -54,6 +77,15 @@ public AzPSApplicationException(
5477
{
5578
}
5679

80+
/// <summary>
81+
/// Constructor of AzPSApplicationException
82+
/// </summary>
83+
/// <param name="message">The error message that explains the reason for the exception.</param>
84+
/// <param name="errorKind">ErrorKind that causes this exception.</param>
85+
/// <param name="innerException">The exception that is the cause of the current exception. Default value is null.</param>
86+
/// <param name="desensitizedMessage">The error message which doesn't contain PII.</param>
87+
/// <param name="lineNumber">The number of line when exception happens.</param>
88+
/// <param name="filePath">The file path when exception happens.</param>
5789
public AzPSApplicationException(
5890
string message,
5991
ErrorKind errorKind,

src/Common/Exceptions/AzPSArgumentException.cs

+52
Original file line numberDiff line numberDiff line change
@@ -19,38 +19,64 @@
1919

2020
namespace Microsoft.Azure.Commands.Common.Exceptions
2121
{
22+
/// <summary>
23+
/// Representive of ArgumentException in Azure PowerShell
24+
/// </summary>
2225
public class AzPSArgumentException : PSArgumentException, IContainsAzPSErrorData
2326
{
27+
/// <summary>
28+
/// The parameter name that results in this exception.
29+
/// </summary>
2430
private string ErrorParamName
2531
{
2632
get => Data.GetValue<string>(AzurePSErrorDataKeys.ParamNameKey);
2733
set => Data.SetValue(AzurePSErrorDataKeys.ParamNameKey, value);
2834
}
2935

36+
/// <summary>
37+
/// ErrorKind that causes this exception.
38+
/// </summary>
3039
public ErrorKind ErrorKind
3140
{
3241
get => Data.GetValue<ErrorKind>(AzurePSErrorDataKeys.ErrorKindKey);
3342
private set => Data.SetValue(AzurePSErrorDataKeys.ErrorKindKey, value);
3443
}
3544

45+
/// <summary>
46+
/// The error message which doesn't contain PII.
47+
/// </summary>
3648
public string DesensitizedErrorMessage
3749
{
3850
get => Data.GetValue<string>(AzurePSErrorDataKeys.DesensitizedErrorMessageKey);
3951
private set => Data.SetValue(AzurePSErrorDataKeys.DesensitizedErrorMessageKey, value);
4052
}
4153

54+
/// <summary>
55+
/// The number of line when exception happens.
56+
/// </summary>
4257
public int? ErrorLineNumber
4358
{
4459
get => Data.GetNullableValue<int>(AzurePSErrorDataKeys.ErrorLineNumberKey);
4560
private set => Data.SetValue(AzurePSErrorDataKeys.ErrorLineNumberKey, value);
4661
}
4762

63+
/// <summary>
64+
/// The file name when exception happens.
65+
/// </summary>
4866
public string ErrorFileName
4967
{
5068
get => Data.GetValue<string>(AzurePSErrorDataKeys.ErrorFileNameKey);
5169
private set => Data.SetValue(AzurePSErrorDataKeys.ErrorFileNameKey, value);
5270
}
5371

72+
/// <summary>
73+
/// Construtor of AzPSArgumentException
74+
/// </summary>
75+
/// <param name="message">The error message that explains the reason for the exception.</param>
76+
/// <param name="paramName">The parameter name that results in this exception.</param>
77+
/// <param name="desensitizedMessage">The error message which doesn't contain PII.</param>
78+
/// <param name="lineNumber">The number of line when exception happens.</param>
79+
/// <param name="filePath">The file path when exception happens.</param>
5480
public AzPSArgumentException(
5581
string message,
5682
string paramName,
@@ -61,6 +87,15 @@ public AzPSArgumentException(
6187
{
6288
}
6389

90+
/// <summary>
91+
/// Construtor of AzPSArgumentException
92+
/// </summary>
93+
/// <param name="message">The error message that explains the reason for the exception.</param>
94+
/// <param name="paramName">The parameter name that results in this exception.</param>
95+
/// <param name="errorKind">ErrorKind that causes this exception.</param>
96+
/// <param name="desensitizedMessage">The error message which doesn't contain PII.</param>
97+
/// <param name="lineNumber">The number of line when exception happens.</param>
98+
/// <param name="filePath">The file path when exception happens.</param>
6499
public AzPSArgumentException(
65100
string message,
66101
string paramName,
@@ -81,6 +116,14 @@ public AzPSArgumentException(
81116
}
82117
}
83118

119+
/// <summary>
120+
/// Construtor of AzPSArgumentException
121+
/// </summary>
122+
/// <param name="message">The error message that explains the reason for the exception.</param>
123+
/// <param name="innerException">The exception that is the cause of the current exception. Default value is null.</param>
124+
/// <param name="desensitizedMessage">The error message which doesn't contain PII.</param>
125+
/// <param name="lineNumber">The number of line when exception happens.</param>
126+
/// <param name="filePath">The file path when exception happens.</param>
84127
public AzPSArgumentException(
85128
string message,
86129
Exception innerException,
@@ -91,6 +134,15 @@ public AzPSArgumentException(
91134
{
92135
}
93136

137+
/// <summary>
138+
/// Construtor of AzPSArgumentException
139+
/// </summary>
140+
/// <param name="message">The error message that explains the reason for the exception.</param>
141+
/// <param name="innerException">The exception that is the cause of the current exception. Default value is null.</param>
142+
/// <param name="errorKind">ErrorKind that causes this exception.</param>
143+
/// <param name="desensitizedMessage">The error message which doesn't contain PII.</param>
144+
/// <param name="lineNumber">The number of line when exception happens.</param>
145+
/// <param name="filePath">The file path when exception happens.</param>
94146
public AzPSArgumentException(
95147
string message,
96148
Exception innerException,

src/Common/Exceptions/AzPSArgumentNullException.cs

+52
Original file line numberDiff line numberDiff line change
@@ -19,38 +19,64 @@
1919

2020
namespace Microsoft.Azure.Commands.Common.Exceptions
2121
{
22+
/// <summary>
23+
/// Representive of ArgumentNullException in Azure PowerShell
24+
/// </summary>
2225
public class AzPSArgumentNullException : PSArgumentNullException, IContainsAzPSErrorData
2326
{
27+
/// <summary>
28+
/// The parameter name that results in this exception.
29+
/// </summary>
2430
private string ErrorParamName
2531
{
2632
get => Data.GetValue<string>(AzurePSErrorDataKeys.ParamNameKey);
2733
set => Data.SetValue(AzurePSErrorDataKeys.ParamNameKey, value);
2834
}
2935

36+
/// <summary>
37+
/// ErrorKind that causes this exception.
38+
/// </summary>
3039
public ErrorKind ErrorKind
3140
{
3241
get => Data.GetValue<ErrorKind>(AzurePSErrorDataKeys.ErrorKindKey);
3342
private set => Data.SetValue(AzurePSErrorDataKeys.ErrorKindKey, value);
3443
}
3544

45+
/// <summary>
46+
/// The error message which doesn't contain PII.
47+
/// </summary>
3648
public string DesensitizedErrorMessage
3749
{
3850
get => Data.GetValue<string>(AzurePSErrorDataKeys.DesensitizedErrorMessageKey);
3951
private set => Data.SetValue(AzurePSErrorDataKeys.DesensitizedErrorMessageKey, value);
4052
}
4153

54+
/// <summary>
55+
/// The number of line when exception happens.
56+
/// </summary>
4257
public int? ErrorLineNumber
4358
{
4459
get => Data.GetNullableValue<int>(AzurePSErrorDataKeys.ErrorLineNumberKey);
4560
private set => Data.SetValue(AzurePSErrorDataKeys.ErrorLineNumberKey, value);
4661
}
4762

63+
/// <summary>
64+
/// The file name when exception happens.
65+
/// </summary>
4866
public string ErrorFileName
4967
{
5068
get => Data.GetValue<string>(AzurePSErrorDataKeys.ErrorFileNameKey);
5169
private set => Data.SetValue(AzurePSErrorDataKeys.ErrorFileNameKey, value);
5270
}
5371

72+
/// <summary>
73+
/// Construtor of AzPSArgumentNullException
74+
/// </summary>
75+
/// <param name="message">The error message that explains the reason for the exception.</param>
76+
/// <param name="paramName">The parameter name that results in this exception.</param>
77+
/// <param name="desensitizedMessage">The error message which doesn't contain PII.</param>
78+
/// <param name="lineNumber">The number of line when exception happens.</param>
79+
/// <param name="filePath">The file path when exception happens.</param>
5480
public AzPSArgumentNullException(
5581
string message,
5682
string paramName,
@@ -61,6 +87,15 @@ public AzPSArgumentNullException(
6187
{
6288
}
6389

90+
/// <summary>
91+
/// Construtor of AzPSArgumentNullException
92+
/// </summary>
93+
/// <param name="message">The error message that explains the reason for the exception.</param>
94+
/// <param name="paramName">The parameter name that results in this exception.</param>
95+
/// <param name="errorKind">ErrorKind that causes this exception.</param>
96+
/// <param name="desensitizedMessage">The error message which doesn't contain PII.</param>
97+
/// <param name="lineNumber">The number of line when exception happens.</param>
98+
/// <param name="filePath">The file path when exception happens.</param>
6499
public AzPSArgumentNullException(
65100
string message,
66101
string paramName,
@@ -80,6 +115,14 @@ public AzPSArgumentNullException(
80115
}
81116
}
82117

118+
/// <summary>
119+
/// Construtor of AzPSArgumentNullException
120+
/// </summary>
121+
/// <param name="message">The error message that explains the reason for the exception.</param>
122+
/// <param name="innerException">The exception that is the cause of the current exception. Default value is null.</param>
123+
/// <param name="desensitizedMessage">The error message which doesn't contain PII.</param>
124+
/// <param name="lineNumber">The number of line when exception happens.</param>
125+
/// <param name="filePath">The file path when exception happens.</param>
83126
public AzPSArgumentNullException(
84127
string message,
85128
Exception innerException,
@@ -90,6 +133,15 @@ public AzPSArgumentNullException(
90133
{
91134
}
92135

136+
/// <summary>
137+
/// Construtor of AzPSArgumentNullException
138+
/// </summary>
139+
/// <param name="message">The error message that explains the reason for the exception.</param>
140+
/// <param name="innerException">The exception that is the cause of the current exception. Default value is null.</param>
141+
/// <param name="errorKind">ErrorKind that causes this exception.</param>
142+
/// <param name="desensitizedMessage">The error message which doesn't contain PII.</param>
143+
/// <param name="lineNumber">The number of line when exception happens.</param>
144+
/// <param name="filePath">The file path when exception happens.</param>
93145
public AzPSArgumentNullException(
94146
string message,
95147
Exception innerException,

0 commit comments

Comments
 (0)