Certain requests exceptions are poorly handled with file sources
Metadata
Current evaluation
No evaluation has been recorded for this issue yet.
Issue body
### Bug Description
Certain exceptions that can be raised when downloading file sources are not handled well, resulting in poor output to the user.
### To Reproduce
Build the nodejs edge snap on riscv64: https://launchpad.net/~openjs/+snap/nodeedge/
Example failure: https://launchpadlibrarian.net/831328493/buildlog_snap_ubuntu_noble_riscv64_nodeedge_BUILDING.txt.gz
### part yaml
```shell
```
### Relevant log output
```shell
[14/Nov/2025:14:05:08 +0000] "CONNECT git.launchpad.net:443 HTTP/1.1" 200 969982 "-" "git/2.43.0"
Running pull phase...
Initialising lifecycle
Installing build-packages
[14/Nov/2025:14:09:44 +0000] "GET http://ftpmaster.internal/ubuntu/dists/noble/InRelease HTTP/1.1" 304 - "-" "Debian APT-HTTP/1.3 (2.8.3) non-interactive"
[14/Nov/2025:14:09:45 +0000] "GET http://ftpmaster.internal/ubuntu/dists/noble-security/InRelease HTTP/1.1" 304 - "-" "Debian APT-HTTP/1.3 (2.8.3) non-interactive"
[14/Nov/2025:14:09:45 +0000] "GET http://ftpmaster.internal/ubuntu/dists/noble-updates/InRelease HTTP/1.1" 304 - "-" "Debian APT-HTTP/1.3 (2.8.3) non-interactive"
[14/Nov/2025:14:10:44 +0000] "GET http://ftpmaster.internal/ubuntu/pool/universe/g/gcc-14/cpp-14-riscv64-linux-gnu_14.2.0-4ubuntu2%7e24.04_riscv64.deb HTTP/1.1" 200 15259952 "-" "Debian APT-HTTP/1.3 (2.8.3) non-interactive"
[14/Nov/2025:14:10:47 +0000] "GET http://ftpmaster.internal/ubuntu/pool/universe/g/gcc-14/cpp-14_14.2.0-4ubuntu2%7e24.04_riscv64.deb HTTP/1.1" 200 1042 "-" "Debian APT-HTTP/1.3 (2.8.3) non-interactive"
[14/Nov/2025:14:10:50 +0000] "GET http://ftpmaster.internal/ubuntu/pool/main/g/gcc-14/liblsan0_14.2.0-4ubuntu2%7e24.04_riscv64.deb HTTP/1.1" 200 1194624 "-" "Debian APT-HTTP/1.3 (2.8.3) non-interactive"
[14/Nov/2025:14:10:52 +0000] "GET http://ftpmaster.internal/ubuntu/pool/main/g/gcc-14/libtsan2_14.2.0-4ubuntu2%7e24.04_riscv64.deb HTTP/1.1" 200 2519170 "-" "Debian APT-HTTP/1.3 (2.8.3) non-interactive"
[14/Nov/2025:14:10:56 +0000] "GET http://ftpmaster.internal/ubuntu/pool/main/g/gcc-14/libgcc-14-dev_14.2.0-4ubuntu2%7e24.04_riscv64.deb HTTP/1.1" 200 6471022 "-" "Debian APT-HTTP/1.3 (2.8.3) non-interactive"
[14/Nov/2025:14:11:00 +0000] "GET http://ftpmaster.internal/ubuntu/pool/universe/g/gcc-14/gcc-14-riscv64-linux-gnu_14.2.0-4ubuntu2%7e24.04_riscv64.deb HTTP/1.1" 200 30038002 "-" "Debian APT-HTTP/1.3 (2.8.3) non-interactive"
[14/Nov/2025:14:11:11 +0000] "GET http://ftpmaster.internal/ubuntu/pool/universe/g/gcc-14/libstdc%2b%2b-14-dev_14.2.0-4ubuntu2%7e24.04_riscv64.deb HTTP/1.1" 200 6250916 "-" "Debian APT-HTTP/1.3 (2.8.3) non-interactive"
[14/Nov/2025:14:11:16 +0000] "GET http://ftpmaster.internal/ubuntu/pool/universe/g/gcc-14/g%2b%2b-14-riscv64-linux-gnu_14.2.0-4ubuntu2%7e24.04_riscv64.deb HTTP/1.1" 200 16865962 "-" "Debian APT-HTTP/1.3 (2.8.3) non-interactive"
[14/Nov/2025:14:11:17 +0000] "GET http://ftpmaster.internal/ubuntu/pool/universe/g/gcc-14/gcc-14_14.2.0-4ubuntu2%7e24.04_riscv64.deb HTTP/1.1" 200 511326 "-" "Debian APT-HTTP/1.3 (2.8.3) non-interactive"
[14/Nov/2025:14:11:17 +0000] "GET http://ftpmaster.internal/ubuntu/pool/universe/g/gcc-14/g%2b%2b-14_14.2.0-4ubuntu2%7e24.04_riscv64.deb HTTP/1.1" 200 18960 "-" "Debian APT-HTTP/1.3 (2.8.3) non-interactive"
Installing build-snaps
Pulling node
Fetching stage-packages
Downloading package: libstdc++6
[14/Nov/2025:14:15:26 +0000] "GET http://ftpmaster.internal/ubuntu/pool/main/g/gcc-14/libstdc%2b%2b6_14.2.0-4ubuntu2%7e24.04_riscv64.deb HTTP/1.1" 200 819666 "-" "Debian APT-HTTP/1.3 (2.8.3) non-interactive"
/snap/snapcraft/15987/lib/python3.12/site-packages/apt/package.py:810: Warning: W:Download is performed unsandboxed as root as file '/root/.cache/snapcraft/download/libstdc++6_14.2.0-4ubuntu2~24.04_riscv64.deb' couldn't be accessed by user '_apt'. - pkgAcquire::Run (13: Permission denied)
acq.run()
Downloading package: libgcc-s1
[14/Nov/2025:14:15:28 +0000] "GET http://ftpmaster.internal/ubuntu/pool/main/g/gcc-14/libgcc-s1_14.2.0-4ubuntu2%7e24.04_riscv64.deb HTTP/1.1" 200 62940 "-" "Debian APT-HTTP/1.3 (2.8.3) non-interactive"
Extracting stage package: libstdc++6
Extracting stage package: libgcc-s1
None
Detailed information: ChunkedEncodingError
Full execution log: '/root/.local/state/snapcraft/log/snapcraft-20251114-140830.645281.log'
Build failed
```
Evaluation history
No evaluation history available.