Skip to content

Commit

Permalink
fix: report error on empty experimental fallback
Browse files Browse the repository at this point in the history
Signed-off-by: Alexander Alemayhu <[email protected]>
  • Loading branch information
aalemayhu committed Jan 25, 2025
1 parent 43503e7 commit d9460af
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/lib/parser/exporters/CustomExporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import fs, { PathLike } from 'fs';

import CardGenerator from '../../anki/CardGenerator';
import Deck from '../Deck';
import { NO_PACKAGE_ERROR } from '../../error/constants';

class CustomExporter {
firstDeckName: string;
Expand All @@ -26,6 +27,11 @@ class CustomExporter {
}

configure(payload: Deck[]) {
const hasCards = payload.some((p) => p.cardCount > 0);
if (!hasCards) {
throw NO_PACKAGE_ERROR;
}

fs.writeFileSync(
this.getPayloadInfoPath(),
JSON.stringify(payload, null, 2)
Expand Down

0 comments on commit d9460af

Please sign in to comment.