in client/src/pages/translate/translate.ts [102:121]
async initImageTranslations(image: Blob | undefined, imageURL: string | undefined, words: string[] | undefined): Promise<void> {
if (!image) {
const debugImageUrl = this.config.debugImageUrl;
if (!debugImageUrl) {
logger.warn('Image not found in state - returning to previous screen');
throw new Error('Image not found');
} else if (words) {
const debugImage = await this.loadImage(debugImageUrl);
await this.setImageData(debugImage, debugImageUrl);
await this.loadTranslations(words);
} else {
throw new WordsNotFoundError('Words not set');
}
} else if (!words) {
throw new WordsNotFoundError('Words not set');
} else {
await this.setImageData(image, imageURL);
await this.loadTranslations(words);
}
}