diff options
| author | DJ O'Leary <dijitol@proton.me> | 2025-12-08 01:55:28 +0100 |
|---|---|---|
| committer | DJ O'Leary <dijitol@proton.me> | 2025-12-08 01:57:20 +0100 |
| commit | 0f34d9a931791406d2cabf282742530195f71927 (patch) | |
| tree | 076e546f64f8f541e91bf135d5d5c78cde173ccf /2025/ocaml/lib/presentation/cli.ml | |
| parent | 63c4dea442acb32db82318b4399ac05fb955e6d0 (diff) | |
refactor(2025,ocaml): use result type for answers to allow for returning errors
Diffstat (limited to '2025/ocaml/lib/presentation/cli.ml')
| -rw-r--r-- | 2025/ocaml/lib/presentation/cli.ml | 7 |
1 files changed, 5 insertions, 2 deletions
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 -> |
