|
23 | 23 | [%%shared open Eliom_content.Html.F ] |
24 | 24 | [%%client open Eliom_shared ] |
25 | 25 |
|
26 | | -let%shared default_fail e = |
| 26 | +let%shared default_fail_fun e = |
27 | 27 | [ |
28 | 28 | if Eliom_config.get_debugmode () |
29 | 29 | then em [ pcdata (Printexc.to_string e) ] |
30 | | - else em ~a:[ a_class ["ot-icon-question"] ] |
31 | | - [ pcdata (Printexc.to_string e) ] ] |
| 30 | + else begin |
| 31 | + let e = Printexc.to_string e in |
| 32 | + ignore [%client (Firebug.console##error |
| 33 | + (Js.string ("Ot_spinner content failed with "^ ~%e)) |
| 34 | + : unit)]; |
| 35 | + em ~a:[ a_class ["ot-icon-error"] ] [] |
| 36 | + end |
| 37 | + ] |
| 38 | + |
| 39 | +let%shared default_fail_ref |
| 40 | + : (exn -> Html_types.div_content Eliom_content.Html.elt list) ref |
| 41 | + = ref default_fail_fun |
| 42 | + |
| 43 | +let%shared default_fail e = |
| 44 | + (!default_fail_ref e |
| 45 | + : Html_types.div_content Eliom_content.Html.elt list |
| 46 | + :> [< Html_types.div_content ] Eliom_content.Html.elt list) |
| 47 | + |
| 48 | +let%shared set_default_fail f = default_fail_ref := |
| 49 | + (f : exn -> [< Html_types.div_content ] Eliom_content.Html.elt list |
| 50 | + :> exn -> Html_types.div_content Eliom_content.Html.elt list) |
32 | 51 |
|
33 | 52 | let%server with_spinner ?(a = []) ?fail thread = |
34 | 53 | let a = (a :> Html_types.div_attrib attrib list) in |
@@ -72,7 +91,10 @@ let cl_spinner = "ot-icon-spinner" |
72 | 91 |
|
73 | 92 | let replace_content ?fail elt thread = |
74 | 93 | let fail = match fail with |
75 | | - | Some fail -> fail |
| 94 | + | Some fail -> |
| 95 | + (fail |
| 96 | + : exn -> [< Html_types.div_content ] Eliom_content.Html.elt list Lwt.t |
| 97 | + :> exn -> Html_types.div_content Eliom_content.Html.elt list Lwt.t) |
76 | 98 | | None -> fun e -> Lwt.return (default_fail e) |
77 | 99 | in |
78 | 100 | inc_active_spinners (); |
|
0 commit comments