let safe_load to_utf8 file =
try Tdl.group_of_file file
with e ->
let err =
match e with
Xml.File_not_found s -> Printf.sprintf "File not found: %s" s
| Xml.Error e ->
Printf.sprintf "File %s: %s" file (Xml.error e)
| Failure s | Sys_error s -> s
| e -> raise e
in
GToolbox.message_box "Error" (to_utf8 err);
Tdl.group ()