Skip to content

Commit

Permalink
Make modal errors less scary 👻
Browse files Browse the repository at this point in the history
  • Loading branch information
antoinepouille committed Oct 4, 2024
1 parent 9f2c5b7 commit 008661f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 15 deletions.
12 changes: 2 additions & 10 deletions gui/lib/ui_common.ml
Original file line number Diff line number Diff line change
Expand Up @@ -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
[]
Expand Down
8 changes: 3 additions & 5 deletions gui/state/runtime_web_workers.ml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 ();
Expand Down

0 comments on commit 008661f

Please sign in to comment.