map-diff: throw error if the image is missing

This commit is contained in:
macabeus 2022-07-31 21:15:10 +01:00 committed by Gunter Labes
parent 3128987810
commit 612cca3594

View file

@ -67,10 +67,17 @@ const produceImagesGetter = async (): Promise<ImagesGetter> => {
}
const baseImage = images[baseCode]
if (!baseImage) {
throw new Error(`Missing image for "${baseCode}"`)
}
// todo: we should use the defaultBase correctly
if (miscCode) {
const miscImage = images[`^${miscCode}`]
if (!miscImage) {
throw new Error(`Missing image for "^${miscCode}"`)
}
return baseImage.clone().composite(miscImage, 0, 0)
}