@@ -18,6 +18,7 @@ import {
1818 type TableOfContentsItem ,
1919} from '../model/enhanceTableOfContents' ;
2020import { enhancePinnedPost } from '../model/pinnedPost' ;
21+ import { logger } from '../server/lib/logging' ;
2122import { parse as parseStoryPackage , type StoryPackage } from '../storyPackage' ;
2223import type {
2324 AdPlaceholderBlockElement ,
@@ -48,7 +49,7 @@ export type ArticleFields = {
4849export type Gallery = ArticleFields & {
4950 design : ArticleDesign . Gallery ;
5051 bodyElements : ( ImageBlockElement | AdPlaceholderBlockElement ) [ ] ;
51- mainMedia : ImageBlockElement ;
52+ mainMedia ? : ImageBlockElement ;
5253} ;
5354
5455export type OtherArticles = ArticleFields & {
@@ -60,12 +61,12 @@ export type Article = Gallery | OtherArticles;
6061export const getGalleryMainMedia = (
6162 mainMediaElements : FEElement [ ] ,
6263 trailImage ?: ImageBlockElement ,
63- ) : ImageBlockElement => {
64+ ) : ImageBlockElement | undefined => {
6465 const mainMedia = mainMediaElements [ 0 ] ;
6566
6667 if ( isUndefined ( mainMedia ) ) {
6768 if ( isUndefined ( trailImage ) ) {
68- throw new Error ( 'No main media or trail picture found' ) ;
69+ logger . warn ( 'No main media or trail picture found' ) ;
6970 }
7071 return trailImage ;
7172 }
0 commit comments