map-diff: throw error if the image is missing
This commit is contained in:
parent
3128987810
commit
612cca3594
1 changed files with 7 additions and 0 deletions
|
@ -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)
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue