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