Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions app/routes/api.chat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,10 +196,10 @@ export async function action({
);
}
}
const message =
error instanceof Error ? error.message : "An error occurred.";
console.error(error);
return message;
// Log the full error server-side for debugging, but return a generic
// message to the client to avoid leaking stack traces or internal paths.
console.error("Chat stream error:", error);
return "An unexpected error occurred. Please try again later.";
},
});
}
8 changes: 2 additions & 6 deletions src/api/test-setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,11 @@ export async function handleR2TestSetup(
);
console.log(`Uploaded hardcoded content to ${file.bucketPath} in R2`);
} catch (error) {
const errorMessage =
error instanceof Error ? error.message : String(error);
console.error(
`Error uploading hardcoded content to ${file.bucketPath} in R2:`,
errorMessage,
);
results.push(
`Failed to upload hardcoded content to ${file.bucketPath}: ${errorMessage}`,
error,
);
results.push(`Failed to upload hardcoded content to ${file.bucketPath}`);
errors++;
}
}
Expand Down
8 changes: 4 additions & 4 deletions src/api/tools/commonTools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -695,13 +695,13 @@ export async function searchRepositoryCode({
},
};
} catch (error) {
console.error(`Error in searchRepositoryCode: ${error}`);
console.error("Error in searchRepositoryCode:", error);
return {
searchQuery: query,
content: [
{
type: "text" as const,
text: `### Code Search Results for: "${query}"\n\nAn error occurred while searching code: ${error}`,
text: `### Code Search Results for: "${query}"\n\nAn error occurred while searching code. Please try again later.`,
},
],
};
Expand Down Expand Up @@ -766,14 +766,14 @@ export async function fetchUrlContent({ url, env }: { url: string; env: Env }) {
],
};
} catch (error) {
console.error(`Error fetching ${url}: ${error}`);
console.error(`Error fetching ${url}:`, error);
return {
url,
status: "error",
content: [
{
type: "text" as const,
text: `Error fetching content from ${url}: ${error}`,
text: `Error fetching content from ${url}. Please try again later.`,
},
],
};
Expand Down