Skip to content

Commit

Permalink
don’t log errors in subroutines and instead handle at top level
Browse files Browse the repository at this point in the history
  • Loading branch information
yasunariw committed Dec 23, 2020
1 parent 7517aeb commit b47ab24
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions lib/state.ml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,4 @@ let log = Log.from "state"
let save state path =
let data = State_j.string_of_state state |> Yojson.Basic.from_string |> Yojson.Basic.pretty_to_string in
try Lwt.return @@ Ok (write_to_local_file ~data path)
with Sys_error e ->
log#error "failed to write to local file %s: %s" path e;
Lwt.return @@ fmt_error "failed to save state"
with Sys_error e -> Lwt.return @@ fmt_error "error while writing to local file %s: %s\nfailed to save state" path e

0 comments on commit b47ab24

Please sign in to comment.