Skip to content

Commit 90d2639

Browse files
committed
fix: improve generation failure tracking by normalizing error messages
1 parent f5973c8 commit 90d2639

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

custom/VisionAction.vue

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -446,8 +446,16 @@ function getActionLabel(actionType: GenerationAction) {
446446
return actionType.replace('_', ' ');
447447
}
448448
449+
function getGenerationFailureGroupKey(actionType: GenerationAction, error: string) {
450+
const normalizedError = error
451+
.replace(/Please retry in [\d.]+s\.?/g, 'Please retry later.')
452+
.replace(/\b\d+\.\d+s\b/g, '<duration>')
453+
.replace(/\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\b/gi, '<uuid>');
454+
return `${actionType}:${normalizedError}`;
455+
}
456+
449457
function registerGenerationFailure(record: RecordState, actionType: GenerationAction, error: string) {
450-
const key = `${actionType}:${error}`;
458+
const key = getGenerationFailureGroupKey(actionType, error);
451459
let group = generationFailureGroups.get(key);
452460
if (!group) {
453461
group = {

0 commit comments

Comments
 (0)