From 008661f412b529f9d251c438f3c6c83668afbe64 Mon Sep 17 00:00:00 2001 From: Antoine Pouille Date: Fri, 4 Oct 2024 15:35:30 +0200 Subject: [PATCH] =?UTF-8?q?Make=20modal=20errors=20less=20scary=20?= =?UTF-8?q?=F0=9F=91=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gui/lib/ui_common.ml | 12 ++---------- gui/state/runtime_web_workers.ml | 8 +++----- 2 files changed, 5 insertions(+), 15 deletions(-) diff --git a/gui/lib/ui_common.ml b/gui/lib/ui_common.ml index 6c8497384..2a08ff578 100644 --- a/gui/lib/ui_common.ml +++ b/gui/lib/ui_common.ml @@ -344,16 +344,8 @@ let create_modal_error ~(id : string) ~(is_critical : bool) if is_critical then [ Html.txt - "The app will not behave properly after this, please save your files \ - to avoid data loss and reload the app. Please consider "; - Html.a - ~a: - [ - Html.Unsafe.string_attrib "href" - "https://github.com/Kappa-Dev/KappaTools/issues"; - ] - [ Html.txt "opening an issue" ]; - Html.txt "."; + "Some parts of the app might not behave properly after this. In this \ + case, save your work and reload the app."; ] else [] diff --git a/gui/state/runtime_web_workers.ml b/gui/state/runtime_web_workers.ml index bbe455ac4..fcefa9f65 100644 --- a/gui/state/runtime_web_workers.ml +++ b/gui/state/runtime_web_workers.ml @@ -34,9 +34,9 @@ let worker_onmessage ~(debug_printing : bool) ~(worker_name : string) fun response_message -> try process_message response_message with _ as e -> - Kappa_webapp_lib.Ui_common.open_modal_error ~is_critical:true + Kappa_webapp_lib.Ui_common.open_modal_error ~is_critical:false ~error_content: - ("Worker " ^ worker_name ^ " raised the following exception: \r" + ("Worker `" ^ worker_name ^ "` raised the following exception: \r" ^ Printexc.to_string e); raise e ) else @@ -54,9 +54,7 @@ let send_worker_exceptions_to_modal = let onerror ~worker_name ~apply_onerror = Dom.handler (fun _ -> - let error_string : string = - "Error in " ^ worker_name ^ ", it might not be running anymore." - in + let error_string : string = "Error in `" ^ worker_name ^ "`:" in let () = Common.debug ~loc:__LOC__ error_string in Ui_common.open_modal_error ~is_critical:false ~error_content:error_string; apply_onerror ();