File tree Expand file tree Collapse file tree 1 file changed +19
-10
lines changed
src/Common/Commands.Common Expand file tree Collapse file tree 1 file changed +19
-10
lines changed Original file line number Diff line number Diff line change @@ -28,21 +28,30 @@ public ComputeCloudException(CloudException ex)
28
28
{
29
29
}
30
30
31
- protected static string GetErrorMessageWithRequestIdInfo ( CloudException ex )
31
+ protected static string GetErrorMessageWithRequestIdInfo ( CloudException cloudException )
32
32
{
33
- var sb = new StringBuilder ( ex . Message ) ;
33
+ if ( cloudException == null )
34
+ {
35
+ throw new ArgumentNullException ( "cloudException" ) ;
36
+ }
37
+
38
+ var sb = new StringBuilder ( cloudException . Message ) ;
34
39
35
- if ( ex . Response != null && ex . Response . Headers . ContainsKey ( RequestIdHeaderInResponse ) )
40
+ if ( cloudException . Response != null )
36
41
{
37
- if ( sb . Length > 0 )
42
+ var headers = cloudException . Response . Headers ;
43
+ if ( headers != null && headers . ContainsKey ( RequestIdHeaderInResponse ) )
38
44
{
39
- // If the original exception message is not empty, append a new line here.
40
- sb . Append ( Environment . NewLine ) ;
41
- }
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
+ }
42
50
43
- sb . AppendFormat (
44
- Properties . Resources . ComputeCloudExceptionOperationIdMessage ,
45
- ex . Response . Headers [ RequestIdHeaderInResponse ] . FirstOrDefault ( ) ) ;
51
+ sb . AppendFormat (
52
+ Properties . Resources . ComputeCloudExceptionOperationIdMessage ,
53
+ headers [ RequestIdHeaderInResponse ] . FirstOrDefault ( ) ) ;
54
+ }
46
55
}
47
56
48
57
return sb . ToString ( ) ;
You can’t perform that action at this time.
0 commit comments