File tree Expand file tree Collapse file tree 1 file changed +13
-5
lines changed
src/pages/api/[version]/[section]/[page]/[tab] Expand file tree Collapse file tree 1 file changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -15,11 +15,19 @@ export const GET: APIRoute = async ({ params, url }) => {
1515 }
1616
1717 // Get examples with titles directly from the index
18- const index = await fetchApiIndex ( url )
19- const tabKey = createIndexKey ( version , section , page , tab )
20- const examples = index . examples [ tabKey ] || [ ]
21-
22- return createJsonResponse ( examples )
18+ try {
19+ const index = await fetchApiIndex ( url )
20+ const tabKey = createIndexKey ( version , section , page , tab )
21+ const examples = index . examples [ tabKey ] || [ ]
22+
23+ return createJsonResponse ( examples )
24+ } catch ( error ) {
25+ const details = error instanceof Error ? error . message : String ( error )
26+ return createJsonResponse (
27+ { error : 'Failed to load API index' , details } ,
28+ 500 ,
29+ )
30+ }
2331}
2432
2533
You can’t perform that action at this time.
0 commit comments