More insights from CDN Worker (#5558)

This commit is contained in:
Kamil Kisiela 2024-08-29 15:57:28 +02:00 committed by GitHub
parent 42b48708b2
commit 8b04c7adef
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 9 additions and 2 deletions

View file

@ -197,9 +197,12 @@ export const createArtifactRequestHandler = (deps: ArtifactRequestHandler) => {
}
}
breadcrumb('Reading response.text()');
const text = await result.response.text();
breadcrumb('Returning OK 200');
return createResponse(
analytics,
await result.response.text(),
text,
{
status: 200,
headers: {

View file

@ -257,6 +257,8 @@ export class ArtifactStorageReader {
},
});
this.breadcrumb(`Response status: ${response.status}`);
if (response.status === 404) {
return { type: 'notFound' } as const;
}
@ -276,7 +278,9 @@ export class ArtifactStorageReader {
this.breadcrumb(`Failed to read artifact`);
const body = await response.text();
const body = await response
.text()
.catch(error => 'Failed to read response body due to ' + String(error));
throw new Error(`GET request failed with status ${response.status}: ${body}`);
}