MCPcopy Index your code
hub / github.com/RustPython/RustPython / is_unavailable_exception

Function is_unavailable_exception

Lib/test/test_xmlrpc.py:751–766  ·  view source on GitHub ↗

Returns True if the given ProtocolError is the product of a server-side exception caused by the 'temporarily unavailable' response sometimes given by operations on non-blocking sockets.

(e)

Source from the content-addressed store, hash-verified

749# This function prevents errors like:
750# <ProtocolError for localhost:57527/RPC2: 500 Internal Server Error>
751def is_unavailable_exception(e):
752 ''&#x27;Returns True if the given ProtocolError is the product of a server-side
753 exception caused by the 'temporarily unavailable' response sometimes
754 given by operations on non-blocking sockets.''&#x27;
755
756 # sometimes we get a -1 error code and/or empty headers
757 try:
758 if e.errcode == -1 or e.headers is None:
759 return True
760 exc_mess = e.headers.get('X-exception')
761 except AttributeError:
762 # Ignore OSErrors here.
763 exc_mess = str(e)
764
765 if exc_mess and 'temporarily unavailable' in exc_mess.lower():
766 return True
767
768def make_request_and_skipIf(condition, reason):
769 # If we skip the test, we have to make a request because

Callers 15

make_request_and_skipFunction · 0.85
test_simple1Method · 0.85
test_nonasciiMethod · 0.85
test_client_encodingMethod · 0.85
test_introspection1Method · 0.85
test_introspection2Method · 0.85
test_introspection3Method · 0.85
test_introspection4Method · 0.85
test_multicallMethod · 0.85
test_server_encodingMethod · 0.85

Calls 3

strFunction · 0.85
getMethod · 0.45
lowerMethod · 0.45

Tested by

no test coverage detected