Skip to content

Commit 1a7a500

Browse files
add discovery error in retry
1 parent bff0664 commit 1a7a500

File tree

1 file changed

+20
-18
lines changed

1 file changed

+20
-18
lines changed

src/lib/processSnapshot.ts

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -159,24 +159,6 @@ export default async function processSnapshot(snapshot: Snapshot, ctx: Context):
159159
const responseHeaders = response.headers();
160160
ctx.log.debug(`Response headers for ${requestUrl}: ${JSON.stringify(responseHeaders, null, 2)}`);
161161
}
162-
let data = {
163-
statusCode: `${response.status()}`,
164-
url: requestUrl,
165-
resourceType: request.resourceType(),
166-
}
167-
168-
if (!discoveryErrors.browsers[globalBrowser]){
169-
discoveryErrors.browsers[globalBrowser] = {}; }
170-
171-
// Check if the discoveryErrors.browsers[globalBrowser] exists, and if not, initialize it
172-
if (discoveryErrors.browsers[globalBrowser] && !discoveryErrors.browsers[globalBrowser][globalViewport]) {
173-
discoveryErrors.browsers[globalBrowser][globalViewport] = [];
174-
}
175-
176-
// Dynamically push the data into the correct browser and viewport
177-
if (discoveryErrors.browsers[globalBrowser]) {
178-
discoveryErrors.browsers[globalBrowser][globalViewport]?.push(data);
179-
}
180162

181163
let responseOfRetry, bodyOfRetry
182164
ctx.log.debug(`Resource had a disallowed status ${requestUrl} fetching from server again`);
@@ -200,6 +182,26 @@ export default async function processSnapshot(snapshot: Snapshot, ctx: Context):
200182
const responseHeadersRetry = responseOfRetry.headers();
201183
ctx.log.debug(`Response headers for ${requestUrl}: ${JSON.stringify(responseHeadersRetry, null, 2)}`);
202184
}
185+
186+
let data = {
187+
statusCode: `${responseOfRetry.status()}`,
188+
url: requestUrl,
189+
resourceType: request.resourceType(),
190+
}
191+
192+
if (!discoveryErrors.browsers[globalBrowser]){
193+
discoveryErrors.browsers[globalBrowser] = {};
194+
}
195+
196+
// Check if the discoveryErrors.browsers[globalBrowser] exists, and if not, initialize it
197+
if (discoveryErrors.browsers[globalBrowser] && !discoveryErrors.browsers[globalBrowser][globalViewport]) {
198+
discoveryErrors.browsers[globalBrowser][globalViewport] = [];
199+
}
200+
201+
// Dynamically push the data into the correct browser and viewport
202+
if (discoveryErrors.browsers[globalBrowser]) {
203+
discoveryErrors.browsers[globalBrowser][globalViewport]?.push(data);
204+
}
203205
}
204206

205207

0 commit comments

Comments
 (0)