Skip to content

Commit

Permalink
More to catch an exception
Browse files Browse the repository at this point in the history
  • Loading branch information
ermine committed Nov 25, 2014
1 parent cf24960 commit 7b62e8b
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions lang.ml
Expand Up @@ -75,25 +75,27 @@ let process str args =
String.concat "" res

let get_msg lang msgid args =
let htbl = find_htbl lang in
let str = try Hashtbl.find htbl msgid with _ ->
try
let hashtbl = LangMap.find !deflang !langmsgs in
try
let htbl = find_htbl lang in
let str =
try Hashtbl.find htbl msgid with _ ->
let hashtbl = LangMap.find !deflang !langmsgs in
Hashtbl.find hashtbl msgid
with Not_found ->
(*
log#error "lang not found: [%s]\n" msgid;
*)
"[not found in lang pack: " ^ msgid ^ "]"
in
in
process str args
with Not_found ->
(*
log#error "lang not found: [%s]\n" msgid;
*)
"[not found in lang pack: " ^ msgid ^ "]"


let update lang =
try
let htbl = Marshal.from_channel
(open_in_bin (Filename.concat !langdir (lang ^ ext))) in
langmsgs := LangMap.add lang htbl !langmsgs;
"Updated"
(open_in_bin (Filename.concat !langdir (lang ^ ext))) in
langmsgs := LangMap.add lang htbl !langmsgs;
"Updated"
with exn ->
Printexc.to_string exn

Expand Down

0 comments on commit 7b62e8b

Please sign in to comment.