From 0f34d9a931791406d2cabf282742530195f71927 Mon Sep 17 00:00:00 2001 From: DJ O'Leary Date: Mon, 8 Dec 2025 01:55:28 +0100 Subject: refactor(2025,ocaml): use result type for answers to allow for returning errors --- 2025/ocaml/lib/presentation/cli.ml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to '2025/ocaml/lib/presentation/cli.ml') diff --git a/2025/ocaml/lib/presentation/cli.ml b/2025/ocaml/lib/presentation/cli.ml index 371f199..b4c990c 100644 --- a/2025/ocaml/lib/presentation/cli.ml +++ b/2025/ocaml/lib/presentation/cli.ml @@ -2,8 +2,11 @@ let run_solver name solver filepath = let content = Infrastructure.File.read filepath in - let answer = solver content () in - Logs.app (fun m -> m "[%s] ANSWER=%d" name answer) + match solver content () with + | Error msg -> + Logs.app (fun m -> m "[%s] Err=%s" name msg) + | Ok answer -> + Logs.app (fun m -> m "[%s] ANSWER=%d" name answer) let run_day _ = function | 1 -> -- cgit v1.2.3