Skip to content

Commit e858f21

Browse files
committed
Merge branch 'esbenam-update-error-handling-get-translations'
2 parents f14df95 + 44e0ac7 commit e858f21

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

HTMLCS.js

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,19 @@ _global.HTMLCS = new function()
8181
* @return {String}
8282
*/
8383
this.getTranslation = function(text) {
84-
try {
85-
return _global.translation[this.lang][text];
86-
} catch (e) {
84+
var translations = _global.translation[this.lang];
85+
86+
if (!translations) {
87+
throw new Error ('Missing translations for language ' + this.lang);
88+
}
89+
90+
var translation = translations[text];
91+
92+
if (!translation) {
8793
throw new Error('Translation for "' + text + '" does not exist in current language ' + this.lang);
8894
}
95+
96+
return translation;
8997
};
9098

9199
/**

0 commit comments

Comments
 (0)