Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add trace viewer file upload error handling #10243

Merged

Conversation

mxschmitt
Copy link
Member

@mxschmitt mxschmitt commented Nov 11, 2021

This fixes: npx playwright show-trace non-existing.zip

Fixes #10127

@pavelfeldman
Copy link
Member

Looks like #10127 can have a simpler fix. What exact scenario are we fixing here?

@mxschmitt mxschmitt force-pushed the feature/trace-viewer-error-handling branch 2 times, most recently from 370c7e0 to c09143f Compare November 11, 2021 19:12
try {
await traceModel.load(url, progress);
} catch (error) {
if (fetchFromInbuiltTraceViewerServer && error instanceof Error && error.message === 'HTTP error Not Found')
Copy link
Member Author

Choose a reason for hiding this comment

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

since local file URLs also get loaded over HTTP, check if its done via the internal trace viewer web-server and rewrite it that the local file could not be found (instead of showing the http error).

@mxschmitt mxschmitt force-pushed the feature/trace-viewer-error-handling branch from c09143f to 31cb34f Compare November 11, 2021 19:17
// Don't re-use blob file URLs on page load (results in Fetch error)
if (newTraceURL && !newTraceURL.startsWith('blob:'))
setTraceURL(newTraceURL);
}, [setTraceURL]);
Copy link
Member

Choose a reason for hiding this comment

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

What does it mean useEffect around setTraceURL, wouldn't it run only once?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, as the comment says its about if you open trace viewer with a blob URL. Usually old tab, forced reload etc.

@mxschmitt mxschmitt force-pushed the feature/trace-viewer-error-handling branch from 31cb34f to f7f122e Compare November 11, 2021 19:36
@mxschmitt mxschmitt force-pushed the feature/trace-viewer-error-handling branch from f7f122e to eea5888 Compare November 11, 2021 19:57
@mxschmitt mxschmitt force-pushed the feature/trace-viewer-error-handling branch from 5eb02a6 to bd7bc47 Compare November 11, 2021 20:30
@mxschmitt mxschmitt force-pushed the feature/trace-viewer-error-handling branch from bd7bc47 to 37f9ccc Compare November 11, 2021 20:31
@mxschmitt mxschmitt merged commit 8fe3ea7 into microsoft:master Nov 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Trace viewer should print error when the npx playwright show-trace foo.zip does not exist
2 participants