Commit 371083d2 authored by nanahira's avatar nanahira

error on non-existing card

parent 65e14018
Pipeline #41245 passed with stages
in 1 minute and 40 seconds
...@@ -165,6 +165,15 @@ export class AppService extends ConsoleLogger { ...@@ -165,6 +165,15 @@ export class AppService extends ConsoleLogger {
const qty = entry.length; const qty = entry.length;
const cardData = cardDataMap[entry[0]]; const cardData = cardDataMap[entry[0]];
const lang = dto.lang || 'sc';
if (!cardData[`${lang}_name`]) {
throw new BlankReturnMessageDto(
404,
`Card ID ${cardData.id} does not have name for language ${lang.toUpperCase()}`,
).toException();
}
await this.drawTextService.drawTextInBox( await this.drawTextService.drawTextInBox(
doc, doc,
qty.toString(), qty.toString(),
...@@ -173,7 +182,7 @@ export class AppService extends ConsoleLogger { ...@@ -173,7 +182,7 @@ export class AppService extends ConsoleLogger {
); );
await this.drawTextService.drawTextInBox( await this.drawTextService.drawTextInBox(
doc, doc,
cardData[`${dto.lang || 'sc'}_name`] || '', cardData[`${dto.lang || 'sc'}_name`],
moveDown(cord.name, j), moveDown(cord.name, j),
pageIndex, pageIndex,
); );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment