Skip to content

Commit 23a4517

Browse files
committed
Address CRs
1 parent 422520e commit 23a4517

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

src/Common/Commands.Common/ComputeCloudException.cs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,20 +35,20 @@ protected static string GetErrorMessageWithRequestIdInfo(CloudException cloudExc
3535
throw new ArgumentNullException("cloudException");
3636
}
3737

38-
var sb = new StringBuilder(cloudException.Message);
38+
var sb = new StringBuilder();
3939

40-
if (cloudException.Response != null)
40+
if (!string.IsNullOrEmpty(cloudException.Message))
41+
{
42+
sb.Append(cloudException.Message);
43+
}
44+
45+
if (cloudException.Response != null &&
46+
cloudException.Response.Headers != null)
4147
{
4248
var headers = cloudException.Response.Headers;
43-
if (headers != null && headers.ContainsKey(RequestIdHeaderInResponse))
49+
if (headers.ContainsKey(RequestIdHeaderInResponse))
4450
{
45-
if (sb.Length > 0)
46-
{
47-
// If the original exception message is not empty, append a new line here.
48-
sb.Append(Environment.NewLine);
49-
}
50-
51-
sb.AppendFormat(
51+
sb.AppendLine().AppendFormat(
5252
Properties.Resources.ComputeCloudExceptionOperationIdMessage,
5353
headers[RequestIdHeaderInResponse].FirstOrDefault());
5454
}

0 commit comments

Comments
 (0)