mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-11-18 07:50:13 +00:00
fix(engine): name a failed script's origin and error before the free text of its warning (#7256)
This commit is contained in:
@@ -29,7 +29,7 @@ describe("classifyScriptLoadCause", () => {
|
||||
});
|
||||
|
||||
describe("the script-failure warning", () => {
|
||||
it("ends with the closed origin and code of each failed script, and never their URL", () => {
|
||||
it("names the closed origin and code of each failed script before the free text, so a cut message keeps them", () => {
|
||||
vi.spyOn(console, "warn").mockImplementation(() => {});
|
||||
const session = {
|
||||
subTimelineWaitOutcome: "script_failure",
|
||||
@@ -38,13 +38,15 @@ describe("the script-failure warning", () => {
|
||||
{ origin: "local", code: "net::ERR_CONNECTION_RESET" },
|
||||
{ origin: "cdn", code: "http-503" },
|
||||
],
|
||||
pageErrors: [],
|
||||
pageErrors: ["runtime-error:TypeError: " + "x".repeat(600)],
|
||||
warnings: [],
|
||||
} as unknown as CaptureSession;
|
||||
recordSubTimelineWarning(session, 45_000);
|
||||
const [warning] = session.warnings;
|
||||
expect(
|
||||
warning.message.endsWith(" [script_load: local/net::ERR_CONNECTION_RESET, cdn/http-503]"),
|
||||
warning.message.startsWith(
|
||||
"A sub-composition timeline script failed to load [script_load: local/net::ERR_CONNECTION_RESET, cdn/http-503] (",
|
||||
),
|
||||
).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -2559,8 +2559,8 @@ export function recordSubTimelineWarning(session: CaptureSession, timeoutMs: num
|
||||
`${pendingSuffix} (${sources.join(", ")}). Fix the error; a composition animated by ` +
|
||||
`CSS or rAF rather than a GSAP timeline must mark its host with data-no-timeline.`
|
||||
: scriptFailure
|
||||
? `A sub-composition timeline script failed to load (${sources.join(", ")})` +
|
||||
scriptLoadCauseSuffix(loadCauses)
|
||||
? `A sub-composition timeline script failed to load${scriptLoadCauseSuffix(loadCauses)} ` +
|
||||
`(${sources.join(", ")})`
|
||||
: `Sub-composition timelines did not become ready within ${timeoutMs}ms${pendingSuffix}. ` +
|
||||
`This can be intentional: a composition driven by CSS animations or rAF never registers ` +
|
||||
`window.__timelines[id], and marking its host with data-no-timeline skips the wait entirely. ` +
|
||||
|
||||
Reference in New Issue
Block a user