Index: graphspell-js/spellchecker.js ================================================================== --- graphspell-js/spellchecker.js +++ graphspell-js/spellchecker.js @@ -67,14 +67,15 @@ return new IBDAWG(dictionary, sPath); // dictionary can be a filename or a JSON object } } catch (e) { let sfDictionary = (typeof(dictionary) == "string") ? dictionary : dictionary.sLangName + "/" + dictionary.sFileName; + let sErrorMessage = "Error [" + this.sLangCode + "]: <" + sfDictionary + "> not loaded."; if (bNecessary) { - throw "Error: <" + sfDictionary + "> not loaded. " + e.message; + throw sErrorMessage + " | " + e.message; } - console.log("Error: <" + sfDictionary + "> not loaded."); + console.log(sErrorMessage); console.log(e.message); return null; } } Index: graphspell/spellchecker.py ================================================================== --- graphspell/spellchecker.py +++ graphspell/spellchecker.py @@ -48,13 +48,14 @@ if not source: return None try: return ibdawg.IBDAWG(source) except Exception as e: + sErrorMessage = "Error [" + self.sLangCode + "]: <" + str(source) + "> not loaded." if bNecessary: - raise Exception(str(e), "Error: <" + str(source) + "> not loaded.") - print("Error: <" + str(source) + "> not loaded.") + raise Exception(str(e), sErrorMessage) + print(sErrorMessage) traceback.print_exc() return None def _loadTokenizer (self): self.oTokenizer = tokenizer.Tokenizer(self.sLangCode)