mirror of
https://github.com/morluto/rea.git
synced 2026-12-06 17:23:37 +08:00
refactor(trace): share first-record header diagnostics (#17323)
This commit is contained in:
@@ -202,26 +202,17 @@ class TraceStreamRead {
|
||||
this.#headerSeen = true;
|
||||
return;
|
||||
}
|
||||
const raw = parsed.kind === "skipped" ? undefined : parsed.value;
|
||||
if (this.stream.role === "trace" && !this.#headerSeen) {
|
||||
this.header(raw, line.line);
|
||||
return;
|
||||
}
|
||||
if (parsed.kind === "skipped") {
|
||||
if (this.stream.role === "trace" && !this.#headerSeen) {
|
||||
this.#headerSeen = true;
|
||||
this.diagnostic(
|
||||
line.line,
|
||||
"missing-context-header",
|
||||
"A trace member has no initial context-options record; its event version stays unknown.",
|
||||
);
|
||||
return;
|
||||
}
|
||||
if (!this.omitted.has(parsed.type))
|
||||
inventory.reserve(512 + parsed.type.length * 12);
|
||||
this.omitted.set(parsed.type, (this.omitted.get(parsed.type) ?? 0) + 1);
|
||||
return;
|
||||
}
|
||||
const raw = parsed.value;
|
||||
if (this.stream.role === "trace" && !this.#headerSeen) {
|
||||
this.header(raw, line.line);
|
||||
return;
|
||||
}
|
||||
if (!captureObject(raw) || typeof raw.type !== "string") {
|
||||
this.diagnostic(
|
||||
line.line,
|
||||
|
||||
Reference in New Issue
Block a user