package transom
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>
OCaml backend/application logic for desktop WebView apps
Install
dune-project
Dependency
Authors
Maintainers
Sources
v0.2.0.tar.gz
md5=4d0b0117994a250dd343bbc03f65acf5
sha512=629a5e39f3b142ff0391bbcab6a193480d07d04b3a101da85693778dae6539f48b48bc5c36cf24ed4a920da26bab2b9c955d2bb2a5c43fc3dcaec137523a7527
doc/src/transom.runtime/error.ml.html
Source file error.ml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31type t = { code : string; message : string; data : Yojson.Safe.t option } let make ?data code message = { code; message; data } let unknown_method method_ = make "unknown_method" ("Unknown method: " ^ method_) let bad_request message = make "bad_request" message let invalid_json message = make "invalid_json" message let protocol_error message = make "protocol_error" message let internal_error message = make "internal_error" message let to_yojson { code; message; data } = let fields = [ ("code", `String code); ("message", `String message) ] in let fields = match data with | None -> fields | Some value -> fields @ [ ("data", value) ] in `Assoc fields let of_yojson = function | `Assoc fields -> ( let string_field name = match List.assoc_opt name fields with | Some (`String value) -> Ok value | Some _ -> Error (name ^ " must be a string") | None -> Error ("missing field: " ^ name) in match (string_field "code", string_field "message") with | Ok code, Ok message -> Ok { code; message; data = List.assoc_opt "data" fields } | Error message, _ | _, Error message -> Error message) | _ -> Error "error must be an object"
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>