debug: Add logging for grapheme limit errors

Added detailed logging when posts exceed 300 grapheme limit to help
debug the discrepancy between calculated and actual grapheme counts.

Logs now include:
- Post content preview
- Detail URL being used
- Link suffix grapheme count

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-11-09 19:50:43 +00:00
parent 12d26c9d14
commit 6bd0fe65e2

View File

@@ -156,6 +156,9 @@ export async function POST(request: NextRequest) {
const finalGraphemes = getGraphemeLength(postText);
if (finalGraphemes > 300) {
console.error(`[POST /api/nodes] Post ${i + 1} exceeds 300 graphemes (${finalGraphemes})`);
console.error(`[POST /api/nodes] Post content: ${postText.substring(0, 200)}...`);
console.error(`[POST /api/nodes] Detail URL: ${detailUrl}`);
console.error(`[POST /api/nodes] Link suffix graphemes: ${getGraphemeLength(linkSuffix)}`);
throw new Error(`Post exceeds 300 grapheme limit: ${finalGraphemes} graphemes`);
}