Module Runtime_jsoo

A js_of_ocaml wrapper around the Runtime.

Log events

class type code_location = object ... end

Information about the position of the log inside the Catala source file.

class type raw_event = object ... end

Wrapper for the Runtime.raw_event -- directly collected during the program execution.

class type event = object ... end

Wrapper for the Runtime.event -- structured log event parsed from the raw_event ones.

class type event_manager = object ... end
val event_manager : event_manager Js_of_ocaml.Js.t

JS object usable to retrieve and reset log events.

Duration

class type duration = object ... end

Simple JSOO wrapper around Runtime.duration.

val duration_of_js : duration Js_of_ocaml.Js.t -> Catala_runtime.duration
val duration_to_js : Catala_runtime.duration -> duration Js_of_ocaml.Js.t

Date conversion

Date values are encoded to a string in the ISO8601 format: 'YYYY-MM-DD'.

val date_of_js : Js_of_ocaml.Js.js_string Js_of_ocaml.Js.t -> Catala_runtime.date
val date_to_js : Catala_runtime.date -> Js_of_ocaml.Js.js_string Js_of_ocaml.Js.t

Error management

val position_of_js : code_location Js_of_ocaml.Js.t -> Catala_runtime.code_location
val position_to_js : Catala_runtime.code_location -> code_location Js_of_ocaml.Js.t
val execute_or_throw_error : (unit -> 'a) -> 'a

execute_or_throw_error f calls f () and propagates the Catala_runtime.error.NoValue, Catala_runtime.error.Conflict Catala_runtime.error.AssertionFailed exceptions by raising a JS error if needed.