Grammalecte  Check-in [2be0562a74]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:[graphspell] import dictionary: include lang code in error message
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk | graphspell
Files: files | file ages | folders
SHA3-256:2be0562a74955a244316b48eb4649d628223e6502632373234cbd2578315679d
User & Date: olr 2019-05-15 10:47:11
Context
2019-05-15
11:55
[graphspell][core][fr] code cleaning (pylint) check-in: c65b7e2b8b user: olr tags: core, fr, graphspell, trunk
10:47
[graphspell] import dictionary: include lang code in error message check-in: 2be0562a74 user: olr tags: graphspell, trunk
09:15
pylint: exclusion list check-in: a31e62962a user: olr tags: trunk
Changes

Changes to graphspell-js/spellchecker.js.

    65     65                   return new ibdawg.IBDAWG(dictionary, sPath);  // dictionary can be a filename or a JSON object
    66     66               } else {
    67     67                   return new IBDAWG(dictionary, sPath);  // dictionary can be a filename or a JSON object
    68     68               }
    69     69           }
    70     70           catch (e) {
    71     71               let sfDictionary = (typeof(dictionary) == "string") ? dictionary : dictionary.sLangName + "/" + dictionary.sFileName;
           72  +            let sErrorMessage = "Error [" + this.sLangCode + "]: <" + sfDictionary + "> not loaded.";
    72     73               if (bNecessary) {
    73         -                throw "Error: <" + sfDictionary + "> not loaded. " + e.message;
           74  +                throw sErrorMessage + " | " + e.message;
    74     75               }
    75         -            console.log("Error: <" + sfDictionary + "> not loaded.");
           76  +            console.log(sErrorMessage);
    76     77               console.log(e.message);
    77     78               return null;
    78     79           }
    79     80       }
    80     81   
    81     82       loadTokenizer () {
    82     83           if (typeof(tokenizer) !== 'undefined') {

Changes to graphspell/spellchecker.py.

    46     46       def _loadDictionary (self, source, bNecessary=False):
    47     47           "returns an IBDAWG object"
    48     48           if not source:
    49     49               return None
    50     50           try:
    51     51               return ibdawg.IBDAWG(source)
    52     52           except Exception as e:
           53  +            sErrorMessage = "Error [" + self.sLangCode + "]: <" + str(source) + "> not loaded."
    53     54               if bNecessary:
    54         -                raise Exception(str(e), "Error: <" + str(source) + "> not loaded.")
    55         -            print("Error: <" + str(source) + "> not loaded.")
           55  +                raise Exception(str(e), sErrorMessage)
           56  +            print(sErrorMessage)
    56     57               traceback.print_exc()
    57     58               return None
    58     59   
    59     60       def _loadTokenizer (self):
    60     61           self.oTokenizer = tokenizer.Tokenizer(self.sLangCode)
    61     62   
    62     63       def getTokenizer (self):