Skip to content

Commit

Permalink
Handle topic cover info
Browse files Browse the repository at this point in the history
  • Loading branch information
Seth Battis committed Dec 26, 2024
1 parent 6a63235 commit e519cf4
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ export function prepareContent(
case 'Cover Brief':
case 'Cover Image':
case 'Cover Title':
throw new Error(
`All content for ${contentType.Content} is captured by /api/topiccontentget/:TopicID`
);
case 'Roster':
case 'Learning Tool':
throw new Error(`Capturing ${contentType.Content} is not yet supported`);
Expand Down
26 changes: 16 additions & 10 deletions packages/myschoolapp-reporting/src/workflows/Snapshot/Topics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,16 +78,22 @@ export async function capture(
)
});
} catch (error) {
Content?.push({
...item,
ObjectType,
Content: { error }
});
cli.log.error(
`Error capturing Topic ${TopicID} content of type ${
ObjectType?.Name
} for group ${Id}: ${cli.colors.error(error)}`
);
if (
`${error}`.endsWith('is captured by /api/topiccontentget/:TopicID')
) {
Content.push({ ...item, ObjectType });
} else {
Content?.push({
...item,
ObjectType,
Content: { error }
});
cli.log.error(
`Error capturing Topic ${TopicID} content of type ${
ObjectType?.Name
} for group ${Id}: ${cli.colors.error(error)}`
);
}
}
}
Topics.push({ ...topic, Content: Content.length ? Content : undefined });
Expand Down

0 comments on commit e519cf4

Please sign in to comment.