Commit 7e618b3f authored by Jason Williams's avatar Jason Williams
Browse files

Minor fix to exception handling (specifically for file endpoints).

parent 9ffbf36b
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -176,7 +176,7 @@ namespace XboxWdpDriver
                {
                    DevicePortalException exception = e.InnerException as DevicePortalException;

                    Console.WriteLine(string.Format("HTTP Status: {0}, Hresult: 0x{1:X8}. {2}", exception.StatusCode, exception.HResult, exception.Message));
                    Console.WriteLine(string.Format("HTTP Status: {0}, Hresult: 0x{1:X8}. {2}", exception.StatusCode, exception.HResult, exception.Reason));
                }
            }
        }
+13 −1
Original line number Diff line number Diff line
@@ -91,6 +91,12 @@ namespace Microsoft.Tools.WindowsDevicePortal
                        this.HResult = errorResponse.ErrorCode;
                        this.Reason = errorResponse.ErrorMessage;

                        // If we didn't get the Hresult and reason from these properties, try the other ones.
                        if (this.HResult == 0)
                        {
                            this.HResult = errorResponse.Code;
                        }

                        if (string.IsNullOrEmpty(this.Reason))
                        {
                            this.Reason = errorResponse.Reason;
@@ -169,6 +175,12 @@ namespace Microsoft.Tools.WindowsDevicePortal
            [DataMember(Name = "ErrorCode")]
            public int ErrorCode { get; set; }

            /// <summary>
            /// Gets or sets the Code (used by some endpoints instead of ErrorCode).
            /// </summary>
            [DataMember(Name = "Code")]
            public int Code { get; set; }

            /// <summary>
            /// Gets or sets the ErrorMessage
            /// </summary>
@@ -176,7 +188,7 @@ namespace Microsoft.Tools.WindowsDevicePortal
            public string ErrorMessage { get; set; }

            /// <summary>
            /// Gets or sets the Reason
            /// Gets or sets the Reason (used by some endpoints instead of ErrorMessage).
            /// </summary>
            [DataMember(Name = "Reason")]
            public string Reason { get; set; }