Skip to content

Commit

Permalink
catch all exception
Browse files Browse the repository at this point in the history
  • Loading branch information
phuslu committed Oct 10, 2018
1 parent a128fca commit 6276d22
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions ddns
Original file line number Diff line number Diff line change
Expand Up @@ -264,8 +264,11 @@ def _getip(domain):
]
result = Queue()
def _fetch(url):
result.put(urlopen(Request(url, headers={'user-agent':'curl/7.53'}), timeout=5))
logging.info('getip() from %r', url)
try:
result.put(urlopen(Request(url, headers={'user-agent':'curl/7.53'}), timeout=5))
logging.info('getip() from %r', url)
except Exception as e:
logging.exception('getip() from %r error: %s', url, e)
for url in urls:
t = threading.Thread(target=_fetch, args=(url,))
t.setDaemon(True)
Expand Down

0 comments on commit 6276d22

Please sign in to comment.