function decideAlerts()

in packages/pressreader/src/processEdition.ts [290:317]


function decideAlerts(
	maybeCollection: CollectionType | undefined,
	identifiers: CollectionIdentifiers,
	collectionMismatchAlarm: () => void,
	front: string,
) {
	if (identifiers.lookupType === 'id') {
		if (maybeCollection === undefined) {
			console.error(
				JSON.stringify({
					expectedCollectionName: identifiers.name,
					collectionId: identifiers.id,
					front,
					eventType: 'CollectionNotFound',
					message: `Collection not found: ${identifiers.id} (${identifiers.name}) at ${front}`,
				}),
			);
			collectionMismatchAlarm();
		} else if (
			maybeCollection.displayName.trim().toLowerCase() !==
			identifiers.name.trim().toLowerCase()
		) {
			console.warn(
				`Collection name mismatch. Expected: ${identifiers.name}. Found: ${maybeCollection.displayName}`,
			);
		}
	}
}