mirror of
https://github.com/xodio/xod.git
synced 2026-02-20 02:01:20 +01:00
fix(xod-deploy-bin): fix loading newly added package_index.json in extra.txt
This commit is contained in:
@@ -433,13 +433,15 @@ export const listBoards = async (wsPath, cli) => {
|
||||
available: res[1],
|
||||
}))
|
||||
.catch(async err => {
|
||||
if (R.propEq('code', 6, err)) {
|
||||
// Catch error produced by arduino-cli, but actually it's not an error:
|
||||
if (R.propEq('code', 'ENOENT', err)) {
|
||||
// When User added a new URL into `extra.txt` file it causes that
|
||||
// arduino-cli tries to read new JSON but it's not existing yet
|
||||
// so it fails with error "no such file or directory"
|
||||
// To avoid this and make a good UX, we'll force call `updateIndexes`
|
||||
return updateIndexesInternal(wsPath, cli).then(() => listBoards(cli));
|
||||
// and then run `listBoards` again.
|
||||
return updateIndexesInternal(wsPath, cli).then(() =>
|
||||
listBoards(wsPath, cli)
|
||||
);
|
||||
}
|
||||
|
||||
throw createError('UPDATE_INDEXES_ERROR_BROKEN_FILE', {
|
||||
|
||||
Reference in New Issue
Block a user