Make sure non-existing icons do break the build
Summary: Builds didn't fail when using non-existing icons, and the error message was not very clear Also added verification that, before automatically adding an icon to the prefetcher, that icon does exists Reviewed By: jknoxville Differential Revision: D19264063 fbshipit-source-id: 4320d5b960e85e3f15bbca13d69f3063b983a511
This commit is contained in:
committed by
Facebook Github Bot
parent
b7c8d5b996
commit
8a84bcbe29
@@ -132,11 +132,17 @@ function downloadIcons(buildFolder) {
|
||||
}, []);
|
||||
|
||||
return Promise.all(
|
||||
iconURLs.map(({name, size, density}) =>
|
||||
fetch(getIconURL(name, size, density))
|
||||
iconURLs.map(({name, size, density}) => {
|
||||
const url = getIconURL(name, size, density);
|
||||
return fetch(url)
|
||||
.then(res => {
|
||||
if (res.status !== 200) {
|
||||
throw new Error(`Could not download the icon: ${name}`);
|
||||
throw new Error(
|
||||
// eslint-disable-next-line prettier/prettier
|
||||
`Could not download the icon ${name} from ${url}: got status ${
|
||||
res.status
|
||||
}`,
|
||||
);
|
||||
}
|
||||
return res;
|
||||
})
|
||||
@@ -150,9 +156,8 @@ function downloadIcons(buildFolder) {
|
||||
res.body.on('error', reject);
|
||||
fileStream.on('finish', resolve);
|
||||
}),
|
||||
)
|
||||
.catch(console.error),
|
||||
),
|
||||
);
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user