Skip to content

Instantly share code, notes, and snippets.

@sjmh
Last active November 4, 2015 05:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sjmh/2e173ecaa4241d511c25 to your computer and use it in GitHub Desktop.
Save sjmh/2e173ecaa4241d511c25 to your computer and use it in GitHub Desktop.
Here's the code from an execution module:
try:
return client.watch(key, recurse=recurse, wait=True, timeout=timeout, index=index)
except urllib3.exceptions.ReadTimeoutError as e:
return 'got timeout'
except Exception as e:
return str(type(e))
When it runs:
[root@alpha site-packages]# /tmp/watch.py
{'alpha': "<class 'urllib3.exceptions.ReadTimeoutError'>"}
Meaning that it fell through to 'Exception', even though the specific Exception type is right above it and should have returned 'got timeout'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment