Encapsulate by default all Web API calls with execute_or_throw_error

This commit is contained in:
Denis Merigoux 2023-09-15 10:29:31 +02:00
parent 3cc77f4601
commit af1fbe884c
No known key found for this signature in database
GPG Key ID: EE99DCFA365C3EE3
2 changed files with 13 additions and 13 deletions

View File

@ -355,7 +355,9 @@ module To_jsoo = struct
| Topdef _ -> ()
| ScopeDef (_name, body) ->
let fmt_fun_call fmt _ =
Format.fprintf fmt "@[<hv>%a@ |> %a_of_jsoo@ |> %a@ |> %a_to_jsoo@]"
Format.fprintf fmt
"@[<hv>@[<hv 2>execute_or_throw_error@ (@[<hv 2>fun () ->@ %a@ \
|> %a_of_jsoo@ |> %a@ |> %a_to_jsoo@])@]@]"
fmt_input_struct_name body fmt_input_struct_name body format_var
var fmt_output_struct_name body
in

View File

@ -31,21 +31,19 @@ let () =
method computeAllocationsFamiliales
: (AF_web.interface_allocations_familiales_in -> float) Js.callback =
Js.wrap_callback (fun interface_allocations_familiales_in ->
execute_or_throw_error (fun () ->
let result =
interface_allocations_familiales_in
|> AF_web.interface_allocations_familiales
in
result##.iMontantVerse))
let result =
interface_allocations_familiales_in
|> AF_web.interface_allocations_familiales
in
result##.iMontantVerse)
method computeAidesAuLogement
: (AL_web.calculette_aides_au_logement_garde_alternee_in -> float)
Js.callback =
Js.wrap_callback (fun calculette_aides_au_logement_garde_alternee_in ->
execute_or_throw_error (fun () ->
let result =
calculette_aides_au_logement_garde_alternee_in
|> AL_web.calculette_aides_au_logement_garde_alternee
in
result##.aideFinale))
let result =
calculette_aides_au_logement_garde_alternee_in
|> AL_web.calculette_aides_au_logement_garde_alternee
in
result##.aideFinale)
end)