Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

fix: provisional fix for Trace Viewer source 404 (#29192)

Max Schmitt36ebdfb44190
diff --git a/packages/trace-viewer/src/ui/sourceTab.tsx b/packages/trace-viewer/src/ui/sourceTab.tsx
index 50d96f8ee3..9e26bf13a9 100644
--- a/packages/trace-viewer/src/ui/sourceTab.tsx
+++ b/packages/trace-viewer/src/ui/sourceTab.tsx
@@ -67,7 +67,10 @@ export const SourceTab: React.FunctionComponent<{
let response = await fetch(`sha1/src@${sha1}.txt`);
if (response.status === 404)
response = await fetch(`file?path=${encodeURIComponent(file)}`);
- source.content = await response.text();
+ if (response.status >= 400)
+ source.content = `<Unable to read "${file}">`;
+ else
+ source.content = await response.text();
} catch {
source.content = `<Unable to read "${file}">`;
}