Skip to content

Commit

Permalink
prefetch: gracefully handle HTTPException
Browse files Browse the repository at this point in the history
These are distinct from urllib’s HTTPErrors
  • Loading branch information
eigengrau committed Nov 21, 2016
1 parent e28a333 commit 3b235cb
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/tts_tools/prefetch/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import http.client
import os
import sys
import urllib.request
Expand Down Expand Up @@ -112,6 +113,10 @@ def prefetch_file(filename,
print_err("Error ({reason})".format(reason=error))
continue

except http.client.HTTPException as error:
print_err("HTTP error ({reason})".format(reason=error))
continue

# Only for informative purposes.
length = response.getheader('Content-Length', 0)
length_kb = "???"
Expand Down

0 comments on commit 3b235cb

Please sign in to comment.