mirror of
https://github.com/CatalaLang/catala.git
synced 2024-09-19 00:15:39 +03:00
Encapsulate by default all Web API calls with execute_or_throw_error
This commit is contained in:
parent
3cc77f4601
commit
af1fbe884c
@ -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
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user