1
0
mirror of https://github.com/gnosygnu/xowa.git synced 2024-09-28 14:30:51 +00:00

Lang: Add more error message detail to track 'counts do not match' [#330]

This commit is contained in:
gnosygnu 2019-02-12 22:46:15 -05:00
parent a5f8b6e482
commit be4d2fdfb4
2 changed files with 9 additions and 2 deletions

View File

@ -64,7 +64,8 @@ public class Xol_lang_itm implements Gfo_invk {
fallback_hash.Add_as_key_and_val(String_.new_u8(key));
}
} catch (Exception exc) {
throw Err_.new_wo_type("failed to add fallback_bry_ary; v=~{0} err=~{1}", v, Err_.Message_gplx_log(exc));
String[] cur_fallbacks = (String[])fallback_hash.To_ary(String.class);
throw Err_.new_wo_type(String_.Format("failed to add fallback_bry_ary; lang={0} cur_fallbacks={1} new_fallbacks={2} err={3}", key_str, cur_fallbacks, v, Err_.Message_gplx_log(exc)));
}
return this;
} private byte[] fallback_bry;

View File

@ -263,7 +263,13 @@ public class Scrib_lib_language implements Scrib_lib {
}
private Xol_lang_itm lang_(Scrib_proc_args args) {
byte[] lang_code = args.Cast_bry_or_null(0);
Xol_lang_itm lang = lang_code == null ? null : core.App().Lang_mgr().Get_by_or_load(lang_code);
Xol_lang_itm lang = null;
try {
lang = lang_code == null ? null : core.App().Lang_mgr().Get_by_or_load(lang_code);
}
catch (Exception exc) {
throw Err_.new_wo_type("mw.lang: Unable to get lang", "page", core.Page().Url_bry_safe(), "lang", lang_code, "err", Err_.Message_gplx_log(exc));
}
if (lang == null) throw Err_.new_wo_type("lang_code is not valid", "lang_code", String_.new_u8(lang_code));
return lang;
}