@devries-cameron20 / composio-1 / commits / cb02a9ada
Fork 0

Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.

Add error handling to llms-full.txt route

Wrap getPages() call in try-catch to handle potential errors gracefully 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

Sushmithamallesh committed Jan 6, 2026 at 19:48 UTC cb02a9ada1483342e452c046967b27075b0df8ee
1 file changed +25 -15
fumadocs/app/llms-full.txt/route.ts
+25 -15
@@ -3,22 +3,32 @@ import { source } from '@/lib/source';
3 export const revalidate = false;
4
5 export async function GET() {
6 - const pages = source.getPages();
7 - const results: string[] = [];
6 + try {
7 + const pages = source.getPages();
8 + const results: string[] = [];
9
9 - for (const page of pages) {
10 - try {
11 - const processed = await page.data.getText('processed');
12 - results.push(`# ${page.data.title}\n\n${processed}`);
13 - } catch {
14 - // Fallback to basic info if getText fails
15 - results.push(`# ${page.data.title}\n\n${page.data.description || ''}`);
10 + for (const page of pages) {
11 + try {
12 + const processed = await page.data.getText('processed');
13 + results.push(`# ${page.data.title}\n\n${processed}`);
14 + } catch {
15 + // Fallback to basic info if getText fails
16 + results.push(`# ${page.data.title}\n\n${page.data.description || ''}`);
17 + }
18 }
17 - }
19
19 - return new Response(results.join('\n\n'), {
20 - headers: {
21 - 'Content-Type': 'text/plain; charset=utf-8',
22 - },
23 - });
20 + return new Response(results.join('\n\n'), {
21 + headers: {
22 + 'Content-Type': 'text/plain; charset=utf-8',
23 + },
24 + });
25 + } catch (error) {
26 + console.error('[llms-full.txt] Error generating content:', error);
27 + return new Response('Error generating LLM content', {
28 + status: 500,
29 + headers: {
30 + 'Content-Type': 'text/plain; charset=utf-8',
31 + },
32 + });
33 + }
34 }