diff options
author | Elizabeth <me@liz.coffee> | 2025-06-02 16:52:52 -0700 |
---|---|---|
committer | Elizabeth <me@liz.coffee> | 2025-06-02 16:52:52 -0700 |
commit | 98f5c21aa65bbbca01a186a754249335b4afef57 (patch) | |
tree | 0fc8e01a73f0a3be4534c11724ad2ff634b4fd2f /worker/scripts | |
parent | 373d9ec700c0097a22cf665a8e33cf48998d1dc2 (diff) | |
download | ci-98f5c21aa65bbbca01a186a754249335b4afef57.tar.gz ci-98f5c21aa65bbbca01a186a754249335b4afef57.zip |
fixup the Either monad a bit for type safetyp
Diffstat (limited to 'worker/scripts')
-rwxr-xr-x | worker/scripts/build_docker_image | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/worker/scripts/build_docker_image b/worker/scripts/build_docker_image index dc0e961..2e19111 100755 --- a/worker/scripts/build_docker_image +++ b/worker/scripts/build_docker_image @@ -38,7 +38,7 @@ await LogMetricTraceable.from(eitherJob) .bimap( (tEitherJob) => { const trace = "build_docker_image." + - tEitherJob.get().fold((_, v) => v?.arguments.buildTarget ?? ""); + tEitherJob.get().fold(({ isRight, value }) => isRight ? value.arguments.buildTarget : ""); return [tEitherJob.get(), trace]; }, ) @@ -83,8 +83,8 @@ await LogMetricTraceable.from(eitherJob) .peek(async (tEitherWithAuthdRegistry) => { const eitherWithAuthdRegistry = await tEitherWithAuthdRegistry.get(); return tEitherWithAuthdRegistry.trace.trace( - eitherWithAuthdRegistry.fold((err, _val) => - loginMetric[err ? "failure" : "success"] + eitherWithAuthdRegistry.fold(({ isLeft}) => + loginMetric[isLeft ? "failure" : "success"] ), ); }) @@ -112,17 +112,17 @@ await LogMetricTraceable.from(eitherJob) }) .peek(async (tEitherWithBuiltImage) => { const eitherWithBuiltImage = await tEitherWithBuiltImage.get(); - eitherWithBuiltImage.fold((err, val) => { + eitherWithBuiltImage.fold(({ isLeft, value}) => { tEitherWithBuiltImage.trace.trace( - buildImageMetric[err ? "failure" : "success"], + buildImageMetric[isLeft ? "failure" : "success"], ); - if (!val || err) { + if (isLeft) { tEitherWithBuiltImage.trace.addTrace(LogLevel.ERROR).trace( - `oh nyoo we couldn't buiwd the img :(( ${err}`, + `oh nyoo we couldn't buiwd the img :(( ${value}`, ); return; } - tEitherWithBuiltImage.trace.addTrace("buildOutput").trace(val.buildOutput); + tEitherWithBuiltImage.trace.addTrace("buildOutput").trace(value.buildOutput); }); }) .map(async (tEitherWithBuiltImage) => { |