it compiles, now we get "exc during Lwt.async: Not_found"

This commit is contained in:
cqc
2024-03-29 20:25:55 -05:00
parent df15ad7efd
commit 47514a71de

View File

@ -3,16 +3,22 @@ open Js_of_ocaml_tyxml
open Lwt open Lwt
open Store open Store
open Tyxml open Tyxml
module F = Fmt
let by_id s = Dom_html.getElementById s let by_id s = Dom_html.getElementById s
let by_id_coerce s f = let by_id_coerce s f =
Js.Opt.get Js.Opt.get
(f (Dom_html.getElementById s)) (f (Dom_html.getElementById s))
(fun () -> raise Not_found) (fun () ->
Firebug.console##log (F.str "by_id_coerce Not_found");
raise Not_found)
let do_by_id s f = let do_by_id s f =
try f (Dom_html.getElementById s) with Not_found -> () try f (Dom_html.getElementById s)
with Not_found ->
Firebug.console##log (F.str "do_by_id Not_found");
()
let resize ~container ~textbox () = let resize ~container ~textbox () =
Lwt.pause () >>= fun () -> Lwt.pause () >>= fun () ->
@ -47,7 +53,10 @@ let setup_workspace ~container cstore : unit Lwt.t =
Lwt_list.iter_s Lwt_list.iter_s
(fun (step, tree) -> (fun (step, tree) ->
Firebug.console##log (F.str ".config/workspace/%s" step); Firebug.console##log (F.str ".config/workspace/%s" step);
Store.S.Tree.get tree [] >>= fun contents -> (try Store.S.Tree.get tree []
with Not_found ->
Lwt.return "print_newline \"rootstore:// not found?\";;")
>>= fun contents ->
let headers = let headers =
headers_of_string_list (String.split_on_char '\n' contents) headers_of_string_list (String.split_on_char '\n' contents)
in in
@ -110,7 +119,12 @@ let _ =
Store.test_pull () >>= fun (remote, s) -> Store.test_pull () >>= fun (remote, s) ->
Store.S.tree s >>= fun root_tree -> Store.S.tree s >>= fun root_tree ->
let workspace_store = let workspace_store =
Store.S.Tree.find_tree root_tree [ ".config"; "workspace" ] (try
Store.S.Tree.find_tree root_tree [ ".config"; "workspace" ]
with Not_found ->
Firebug.console##log
(F.str "rootstore://.config/workspace Not_found");
raise Not_found)
>>= function >>= function
| Some t -> Lwt.return t | Some t -> Lwt.return t
| None -> Lwt.return (Store.S.Tree.empty ()) | None -> Lwt.return (Store.S.Tree.empty ())