generate-sysdig-event.py: improve error reporting.
Catch particular exceptions and print a more detailed error. Change-Id: Ied98c6d0bc0410eb8b9cb2a98f7264e980c2bb28 Reviewed-on: https://code.wireshark.org/review/37529 Petri-Dish: Guy Harris <gharris@sonic.net> Tested-by: Petri Dish Buildbot Reviewed-by: Guy Harris <gharris@sonic.net>
This commit is contained in:
parent
78a507b142
commit
9e1fbfb766
|
@ -41,8 +41,14 @@ def get_url_lines(url):
|
|||
response = urllib.request.urlopen(req)
|
||||
lines = response.read().decode().splitlines()
|
||||
response.close()
|
||||
except urllib.error.HTTPError as err:
|
||||
print("HTTP error fetching {0}: {1}".format(url, err.reason))
|
||||
except urllib.error.URLError as err:
|
||||
print("URL error fetching {0}: {1}".format(url, err.reason))
|
||||
except OSError as err:
|
||||
print("OS error fetching {0}".format(url, err.strerror))
|
||||
except:
|
||||
exit_msg('Error opening ' + url)
|
||||
print("Unexpected error:", sys.exc_info()[0])
|
||||
|
||||
return lines
|
||||
|
||||
|
|
Loading…
Reference in New Issue