File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed
Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -205,8 +205,11 @@ def _get_request_type(self, response):
205205 "raise if request_type == RESPONSE_TYPE_FAIL"
206206 request_type = struct .unpack ("<I" , response .data [:4 ])[0 ]
207207 if request_type == gdef .RPC_RESPONSE_TYPE_FAIL :
208- error_code = struct .unpack ("<5I" , response .data )[2 ]
209- raise ValueError ("RPC Response error {0} ({1!r})" .format (error_code , KNOWN_RPC_ERROR_CODE .get (error_code , error_code )))
208+ effective_error_code = error_code = struct .unpack ("<5I" , response .data )[2 ]
209+ # https://learn.microsoft.com/en-us/windows/win32/com/structure-of-com-error-codes
210+ if gdef .HRESULT_FACILITY (error_code ) == gdef .FACILITY_WIN32 :
211+ effective_error_code = effective_error_code & 0xffff
212+ raise ValueError ("RPC Response error {0:#x} ({1!r})" .format (error_code , KNOWN_RPC_ERROR_CODE [effective_error_code ]))
210213 return request_type
211214
212215 def _get_response_effective_data (self , response ):
You can’t perform that action at this time.
0 commit comments