M3: console.log -> Logger + UI redesign (QuestionBank) + S7/A9/A10/A11/U11 bug fixes + #1/#2/#3/#4 enhancements + i18n for QuestionBank pages

This commit is contained in:
Developer
2026-05-19 16:57:45 +08:00
parent 5b5f14674d
commit 29bac74b58
20 changed files with 1081 additions and 501 deletions
+7 -3
View File
@@ -1,3 +1,7 @@
import { Logger } from '@nestjs/common';
const logger = new Logger('JsonUtils');
/**
* Safely parses JSON from a string, handling markdown code blocks and leading/trailing text.
*/
@@ -40,9 +44,9 @@ export function safeParseJson<T = any>(text: string): T | null {
try {
return JSON.parse(jsonStr) as T;
} catch (error) {
console.error('[safeParseJson] Failed to parse JSON:', error);
console.error('[safeParseJson] Original text:', text);
console.error('[safeParseJson] Extracted string:', jsonStr);
logger.error('[safeParseJson] Failed to parse JSON:', error);
logger.error('[safeParseJson] Original text:', text);
logger.error('[safeParseJson] Extracted string:', jsonStr);
return null;
}
}