Skip to content

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

Sushmithamalleshcb02a9ada148
diff --git a/fumadocs/app/llms-full.txt/route.ts b/fumadocs/app/llms-full.txt/route.ts
index 65655e37d..187b91067 100644
--- a/fumadocs/app/llms-full.txt/route.ts
+++ b/fumadocs/app/llms-full.txt/route.ts
@@ -3,22 +3,32 @@ import { source } from '@/lib/source';
export const revalidate = false;
export async function GET() {
- const pages = source.getPages();
- const results: string[] = [];
+ try {
+ const pages = source.getPages();
+ const results: string[] = [];
- for (const page of pages) {
- try {
- const processed = await page.data.getText('processed');
- results.push(`# ${page.data.title}\n\n${processed}`);
- } catch {
- // Fallback to basic info if getText fails
- results.push(`# ${page.data.title}\n\n${page.data.description || ''}`);
+ for (const page of pages) {
+ try {
+ const processed = await page.data.getText('processed');
+ results.push(`# ${page.data.title}\n\n${processed}`);
+ } catch {
+ // Fallback to basic info if getText fails
+ results.push(`# ${page.data.title}\n\n${page.data.description || ''}`);
+ }
}
- }
- return new Response(results.join('\n\n'), {
- headers: {
- 'Content-Type': 'text/plain; charset=utf-8',
- },
- });
+ return new Response(results.join('\n\n'), {
+ headers: {
+ 'Content-Type': 'text/plain; charset=utf-8',
+ },
+ });
+ } catch (error) {
+ console.error('[llms-full.txt] Error generating content:', error);
+ return new Response('Error generating LLM content', {
+ status: 500,
+ headers: {
+ 'Content-Type': 'text/plain; charset=utf-8',
+ },
+ });
+ }
}