Skip to content
Commit 837e0a0e authored by Angelos Evripiotis's avatar Angelos Evripiotis Committed by Angelos Evripiotis
Browse files

_downloadablefilesource: handle ValueError-s

Avoid unhandled exceptions like the following:

    Traceback (most recent call last):
    ...
        File "/src/buildstream/buildstream/plugins/sources/_downloadablefilesource.py", line 108, in _ensure_mirror
        request = urllib.request.Request(self.url)
        File "/usr/lib/python3.6/urllib/request.py", line 329, in __init__
        self.full_url = url
        File "/usr/lib/python3.6/urllib/request.py", line 355, in full_url
        self._parse()
        File "/usr/lib/python3.6/urllib/request.py", line 384, in _parse
        raise ValueError("unknown url type: %r" % self.full_url)
    ValueError: unknown url type: 'https//github.com/winlibs/icu4c.tar'

Explicitly handle ValueErrors, so that we report this condition in the
usual way:

    [00:00:00] FAILURE element.bst: tar source at
        element.bst [line 10 column 2]: Error mirroring
        https//github.com/winlibs/icu4c.tar: unknown url type:
        'https//github.com/winlibs/icu4c.tar'

Fixes #452 "Mistyped urls can cause a stack trace".
parent 552f5fc6
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment