feat(frontend): gebruikersvriendelijkere foutmeldingen voor foutieve leerpaden

This commit is contained in:
Gerald Schmittinger 2025-05-14 23:10:31 +02:00
parent ac933df57b
commit 759282f1c6
7 changed files with 22 additions and 8 deletions

View file

@ -93,7 +93,10 @@ export class LearningPath {
const startNodeDtos = dto.nodes.filter((it) => it.start_node === true);
if (startNodeDtos.length < 1) {
// The learning path has no starting node -> use the first node.
return dto.nodes[0];
if (dto.nodes.length > 0) {
return dto.nodes[0];
}
throw new Error("emptyLearningPath");
} // The learning path has 1 or more starting nodes -> use the first start node.
return startNodeDtos[0];
}