-
-
Couldn't load subscription status.
- Fork 431
Description
BUG
Steps to reproduce
- Open
.cli-config.yml - Add additional URL:
http://google.com/package_lalala_index.json. But let's imagine that URL is correct and should contain realpackage_lalala_index.json, but the server has gone down and returns 500 HTTP error. - Run
arduino-cli core update-index— it says all packages downloaded
Expected behavior
On the last step (update-index) we get an HTTP 500 error.
Probably, get an error in the stderr, but download other, available and valid, package indexes.
And then I can run arduino-cli core list and see no errors.
Actual behavior
It says all packages were downloaded:
Updating index: package_index.json downloaded
Updating index: package_esp8266com_index.json downloaded
Updating index: package_lalala_index.json downloaded
But when you run commands like arduino-cli core list or arduino-cli board listall it exits with an error:
Error: loading json index file /Users/MY_USER_NAME/arduino-cli/data/package_lalala_index.json: invalid character '<' looking for beginning of value
Failed to load http://google.com/package_lalala_index.json package index.
Try updating all indexes with `arduino-cli core update-index`.
It occurs, because package_lalala_index.json contains 404 HTML page.
Proposal how to fix
After downloading — check is it valid JSON (just try to parse).
And if not — delete it and add an error into stderr.
And if its possible to verify that is valid package file, it will be awesome.