Mistyped urls can cause a stack trace
Background
If one doesn't enter a valid url in a .bst file and try to fetch it, urllib raises a ValueError which doesn't get handled, causing an ugly stack trace. E.g:
Failure Summary
base/icu.bst:
[00:00:00][a31d0083][fetch:base/icu.bst ] BUG Fetch
An unhandled exception occured:
Traceback (most recent call last):
File "/home/thomascoldrick/buildstream/buildstream/_scheduler/job.py", line 320, in _child_action
result = self._action_cb(element)
File "/home/thomascoldrick/buildstream/buildstream/_scheduler/fetchqueue.py", line 44, in process
source._fetch()
File "/home/thomascoldrick/buildstream/buildstream/source.py", line 378, in _fetch
self.fetch()
File "/home/thomascoldrick/buildstream/buildstream/plugins/sources/_downloadablefilesource.py", line 90, in fetch
sha256, _ = self._ensure_mirror()
File "/home/thomascoldrick/buildstream/buildstream/plugins/sources/_downloadablefilesource.py", line 100, in _ensure_mirror
request = urllib.request.Request(self.url)
File "/usr/lib/python3.5/urllib/request.py", line 269, in __init__
self.full_url = url
File "/usr/lib/python3.5/urllib/request.py", line 295, in full_url
self._parse()
File "/usr/lib/python3.5/urllib/request.py", line 324, in _parse
raise ValueError("unknown url type: %r" % self.full_url)
ValueError: unknown url type: 'https//github.com/winlibs/icu4c'
[00:00:00][a31d0083][fetch:base/icu.bst ] BUG Fetch
An unhandled exception occured:
Traceback (most recent call last):
File "/home/thomascoldrick/buildstream/buildstream/_scheduler/job.py", line 320, in _child_action
result = self._action_cb(element)
File "/home/thomascoldrick/buildstream/buildstream/_scheduler/fetchqueue.py", line 44, in process
source._fetch()
File "/home/thomascoldrick/buildstream/buildstream/source.py", line 378, in _fetch
self.fetch()
File "/home/thomascoldrick/buildstream/buildstream/plugins/sources/_downloadablefilesource.py", line 90, in fetch
sha256, _ = self._ensure_mirror()
File "/home/thomascoldrick/buildstream/buildstream/plugins/sources/_downloadablefilesource.py", line 100, in _ensure_mirror
request = urllib.request.Request(self.url)
File "/usr/lib/python3.5/urllib/request.py", line 269, in __init__
self.full_url = url
File "/usr/lib/python3.5/urllib/request.py", line 295, in full_url
self._parse()
File "/usr/lib/python3.5/urllib/request.py", line 324, in _parse
raise ValueError("unknown url type: %r" % self.full_url)
ValueError: unknown url type: 'https//github.com/winlibs/icu4c'
[00:00:00][a31d0083][fetch:base/icu.bst ] BUG Fetch
An unhandled exception occured:
Traceback (most recent call last):
File "/home/thomascoldrick/buildstream/buildstream/_scheduler/job.py", line 320, in _child_action
result = self._action_cb(element)
File "/home/thomascoldrick/buildstream/buildstream/_scheduler/fetchqueue.py", line 44, in process
source._fetch()
File "/home/thomascoldrick/buildstream/buildstream/source.py", line 378, in _fetch
self.fetch()
File "/home/thomascoldrick/buildstream/buildstream/plugins/sources/_downloadablefilesource.py", line 90, in fetch
sha256, _ = self._ensure_mirror()
File "/home/thomascoldrick/buildstream/buildstream/plugins/sources/_downloadablefilesource.py", line 100, in _ensure_mirror
request = urllib.request.Request(self.url)
File "/usr/lib/python3.5/urllib/request.py", line 269, in __init__
self.full_url = url
File "/usr/lib/python3.5/urllib/request.py", line 295, in full_url
self._parse()
File "/usr/lib/python3.5/urllib/request.py", line 324, in _parse
raise ValueError("unknown url type: %r" % self.full_url)
ValueError: unknown url type: 'https//github.com/winlibs/icu4c'
However I haven't managed to reproduce it, even without changing anything.