(
record: ErrorRecord,
category: DebugCategory,
severity: DebugSeverity,
timestampUs: bigint,
)
| 168 | } |
| 169 | |
| 170 | function addError( |
| 171 | record: ErrorRecord, |
| 172 | category: DebugCategory, |
| 173 | severity: DebugSeverity, |
| 174 | timestampUs: bigint, |
| 175 | ): void { |
| 176 | const timestamp = Number(timestampUs) / 1000; |
| 177 | const sourceFile = record.sourceFile || undefined; |
| 178 | const id = createErrorId(record.errorCode, record.message, sourceFile); |
| 179 | |
| 180 | totalOccurrences++; |
| 181 | |
| 182 | const existing = errors.get(id); |
| 183 | if (existing) { |
| 184 | // Update existing error |
| 185 | existing.lastOccurrence = timestamp; |
| 186 | existing.count++; |
| 187 | if (existing.frameIds.length < MAX_FRAME_IDS_PER_ERROR) { |
| 188 | // Only add if not already present |
| 189 | if (!existing.frameIds.includes(record.frameId)) { |
| 190 | existing.frameIds.push(record.frameId); |
| 191 | } |
| 192 | } |
| 193 | notifyHandlers(toImmutable(existing)); |
| 194 | } else { |
| 195 | // Create new error |
| 196 | const newError: MutableError = { |
| 197 | id, |
| 198 | category, |
| 199 | severity, |
| 200 | code: record.errorCode, |
| 201 | message: record.message, |
| 202 | sourceFile, |
| 203 | sourceLine: record.sourceLine || undefined, |
| 204 | firstOccurrence: timestamp, |
| 205 | lastOccurrence: timestamp, |
| 206 | count: 1, |
| 207 | frameIds: [record.frameId], |
| 208 | }; |
| 209 | errors.set(id, newError); |
| 210 | errorOrder.push(id); |
| 211 | notifyHandlers(toImmutable(newError)); |
| 212 | } |
| 213 | } |
| 214 | |
| 215 | function all(): readonly AggregatedError[] { |
| 216 | const result: AggregatedError[] = []; |
nothing calls this directly
no test coverage detected