From a16fbd3eaa165b3226a3b0ed9848b51718aaeafa Mon Sep 17 00:00:00 2001 From: Elizabeth Date: Mon, 2 Jun 2025 18:55:32 -0700 Subject: Fixes when the map of an either is expected to be possible undefined --- u/server/activity/health.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'u/server/activity/health.ts') diff --git a/u/server/activity/health.ts b/u/server/activity/health.ts index b9dedf9..3b4a23a 100644 --- a/u/server/activity/health.ts +++ b/u/server/activity/health.ts @@ -35,16 +35,18 @@ export class HealthCheckActivityImpl implements IHealthCheckActivity { return req .bimap(TraceUtil.withFunctionTrace(this.checkHealth)) .bimap(TraceUtil.withMetricTrace(healthCheckMetric)) - .flatMap((r) => r.move(HealthCheckInput.CHECK).map(this.check)) + .flatMap((r) => + r.move(HealthCheckInput.CHECK).map((input) => this.check(input)), + ) .peek( TraceUtil.promiseify((h) => h.get().fold(({ isLeft, value }) => { - if (isLeft) { - h.trace.trace(healthCheckMetric.failure); - h.trace.addTrace(LogLevel.ERROR).trace(`${value}`); + if (!isLeft) { + h.trace.trace(healthCheckMetric.success); return; } - h.trace.trace(healthCheckMetric.success); + h.trace.trace(healthCheckMetric.failure); + h.trace.addTrace(LogLevel.ERROR).trace(`${value}`); }), ), ) -- cgit v1.2.3-70-g09d2