Skip to content

Commit

Permalink
Fix parsing of exceptions struct to json
Browse files Browse the repository at this point in the history
  • Loading branch information
antoinepouille committed Oct 4, 2024
1 parent 008661f commit 390e3c8
Show file tree
Hide file tree
Showing 11 changed files with 197 additions and 97 deletions.
4 changes: 3 additions & 1 deletion core/KaSa_rep/frontend/ckappa_sig.ml
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,9 @@ let rule_id_of_json json =
match json with
| `Assoc [ (s, json) ] when s = "rule_id" -> Yojson.Basic.Util.to_int json
| _ ->
raise (Yojson.Basic.Util.Type_error (JsonUtil.build_msg "rule id", json))
raise
(Yojson.Basic.Util.Type_error
(JsonUtil.exn_msg_cant_import_from_json "rule id", json))

let write_c_rule_id ob f = Yojson.Basic.to_buffer ob (rule_id_to_json f)

Expand Down
13 changes: 9 additions & 4 deletions core/KaSa_rep/remanent_state/remanent_state.ml
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,8 @@ let add_map get title label to_json state l =
| `Assoc [ (s, m) ] when s = label -> m
| x ->
raise
(Yojson.Basic.Util.Type_error (JsonUtil.build_msg title, x))))
(Yojson.Basic.Util.Type_error
(JsonUtil.exn_msg_cant_import_from_json title, x))))
(List.rev y) )
:: l
)
Expand Down Expand Up @@ -344,7 +345,10 @@ let add_triple title label to_json =
->
match to_json l with
| `Assoc [ (s, m) ] when s = label -> m
| x -> raise (Yojson.Basic.Util.Type_error (JsonUtil.build_msg title, x)))
| x ->
raise
(Yojson.Basic.Util.Type_error
(JsonUtil.exn_msg_cant_import_from_json title, x)))

let add_list_triple title lable to_json =
JsonUtil.of_list (add_triple title lable to_json)
Expand Down Expand Up @@ -435,7 +439,7 @@ let of_json = function
with Not_found ->
raise
(Yojson.Basic.Util.Type_error
(JsonUtil.build_msg "no error handler", json))
(JsonUtil.exn_msg_cant_import_from_json "no error handler", json))
in
let contact_maps =
try
Expand Down Expand Up @@ -474,7 +478,8 @@ let of_json = function
separating_transitions )
| x ->
raise
(Yojson.Basic.Util.Type_error (JsonUtil.build_msg "remanent state", x))
(Yojson.Basic.Util.Type_error
(JsonUtil.exn_msg_cant_import_from_json "remanent state", x))

let do_event_gen f phase n state =
let error, log_info =
Expand Down
Loading

0 comments on commit 390e3c8

Please sign in to comment.