Skip to content

Commit

Permalink
Don't catch exceptions for cache items that should exist.
Browse files Browse the repository at this point in the history
  • Loading branch information
tmcgilchrist committed Oct 17, 2023
1 parent cacc4fb commit 8cd5de7
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/lib/solver.ml
Original file line number Diff line number Diff line change
Expand Up @@ -125,19 +125,23 @@ module Cache = struct

let read track : cache_value option =
let fname = fname track in
try
(* try *)
let file = open_in (Fpath.to_string fname) in
let result = Marshal.from_channel file in
close_in file;
Some result
with Failure _ | Sys_error _ -> None
(* with Failure _ | Sys_error _ -> None *)
end

type key = Track.t
type t = { successes : Track.t list; failures : Track.t list }

let keys t = t.successes
let get key = Cache.read key |> Option.get (* is in cache ? *) |> Result.get_ok
let get key =
(* match Cache.read key with *)
(* | Some v -> v |> Result.get_ok *)
(* | None -> Printf.eprintf "get is None for key %s" Track.pp key *)
Cache.read key |> Option.get (* is in cache ? *) |> Result.get_ok

let failures t =
t.failures
Expand Down

0 comments on commit 8cd5de7

Please sign in to comment.