Skip to content

Commit 27daeba

Browse files
removed unnecessary use of then catch and used ctx logger
1 parent 639ef45 commit 27daeba

File tree

2 files changed

+4
-12
lines changed

2 files changed

+4
-12
lines changed

src/lib/httpClient.ts

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -69,16 +69,8 @@ export default class httpClient {
6969
url: '/screenshot',
7070
method: 'GET',
7171
params: { buildId, baseline }
72-
}, log)
73-
.then(response => {
74-
log.debug(`Fetched screenshot data successfully for buildId: ${buildId}`);
75-
return response;
76-
})
77-
.catch(error => {
78-
log.error(`Error fetching screenshot data for buildId: ${buildId}. Error: ${error.message}`);
79-
throw error;
80-
});
81-
}
72+
}, log);
73+
}
8274

8375
finalizeBuild(buildId: string, totalSnapshots: number, log: Logger) {
8476
let params: Record<string, string | number> = {buildId};

src/lib/utils.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ export async function startPolling(ctx: Context, task: any): Promise<void> {
229229
const resp = await ctx.client.getScreenshotData(ctx.build.id, ctx.build.baseline, ctx.log);
230230

231231
if (!resp.build) {
232-
console.error("Error: Build data is null.");
232+
ctx.log.info("Error: Build data is null.");
233233
clearInterval(intervalId);
234234
isPollingActive = false;
235235
}
@@ -279,7 +279,7 @@ export async function startPolling(ctx: Context, task: any): Promise<void> {
279279
);
280280
}
281281
} catch (error: any) {
282-
console.error(`Error fetching screenshot data: ${error.message}`);
282+
ctx.log.error(`Error fetching screenshot data: ${error.message}`);
283283
clearInterval(intervalId);
284284
isPollingActive = false;
285285
}

0 commit comments

Comments
 (0)