Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions packages/replay-internal/src/eventBuffer/WorkerHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ export class WorkerHandler {
if ((data as WorkerResponse).success) {
resolve();
} else {
reject();
DEBUG_BUILD && debug.warn('Received worker message w/ unsuccessful status', data);
reject(new Error('Received worker message w/ unsuccessful status'));
}
},
{ once: true },
Expand All @@ -42,7 +43,12 @@ export class WorkerHandler {
this._worker.addEventListener(
'error',
error => {
reject(error);
DEBUG_BUILD && debug.warn('Failed to load Replay compression worker', error);
reject(
new Error(
`Failed to load Replay compression worker: ${error instanceof ErrorEvent && error.message ? error.message : 'Unknown error. This can happen due to CSP policy restrictions, network issues, or the worker script failing to load.'}`,
),
);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing test for improved error message regression fix

Low Severity · Bugbot Rules

This PR improves error messages when the compression worker fails to load, but no tests were added to verify the improved error messages are actually produced. The existing test at EventBufferProxy.test.ts only checks that the fallback buffer is used when the worker fails, not that the new descriptive Error objects are correctly constructed and rejected with the expected messages. Per the review rules: "When reviewing a fix PR, check if the PR includes at least one unit, integration or e2e test that tests the regression this PR fixes."

Additional Locations (1)

Fix in Cursor Fix in Web

},
{ once: true },
);
Expand Down
Loading