File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -124,15 +124,16 @@ export default async function createNotionSchema(token) {
124124 }
125125
126126 const fetchId = id || parentCache [ parentSlug ] . find ( p => p . slug === slug ) ?. id ;
127- if ( ! fetchId ) return null ;
127+ if ( ! fetchId ) throw new Error ( 'Page not found' ) ;
128128
129129 const allowedPages = Object . values ( parentCache ) . flat ( ) . map ( p => p . id . replace ( / - / g, '' ) ) ;
130130 if ( ! allowedPages . includes ( fetchId . replace ( / - / g, '' ) ) ) {
131- return null ;
131+ throw new Error ( 'Not allowed to fetch page' ) ;
132132 }
133133
134134 const title = ( await notionClient . pages . retrieve ( { page_id : fetchId } ) )
135- . properties ?. Title ?. title ?. [ 0 ] ?. plain_text ;
135+ . properties ?. title ?. title ?. [ 0 ] ?. plain_text || '' ;
136+
136137 const content = n2m . toMarkdownString ( await n2m . pageToMarkdown ( fetchId ) ) . parent ;
137138 return {
138139 title,
Original file line number Diff line number Diff line change 11type Query {
2- page (id : String , parentSlug : String , slug : String ): Page
2+ page (id : String , parentSlug : String , slug : String ): Page !
33 pages (parentSlug : String ! ): [PageInfo ! ]!
44 parentSlugs : [String ]!
55}
You can’t perform that action at this time.
0 commit comments