Grammalecte  Check-in [8fefa29d19]

Overview
Comment:[core] getReadableError changed
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk | core
Files: files | file ages | folders
SHA3-256: 8fefa29d19f6badb36ffa459882c4ab8ea6be05a38a1a7108874c2f729a32a4b
User & Date: olr on 2017-06-04 10:13:39
Other Links: manifest | tags
Context
2017-06-04
13:10
syntax documentation update check-in: 0283fcb23c user: olr tags: trunk, doc
12:14
[core] merge from trunk check-in: f5ad8a3209 user: olr tags: core, fr_killtricks
10:13
[core] getReadableError changed check-in: 8fefa29d19 user: olr tags: trunk, core
10:08
[core] [js] return test number every 1000 lines instead of 100 check-in: dae74786cd user: olr tags: trunk, core
Changes

Modified gc_core/js/text.js from [0a62428d8c] to [f8cb0efb57].

35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
    }
    yield sText;
}

function getReadableError (oErr) {
    // Returns an error oErr as a readable error
    try {
        let s = "\n* " + oErr['nStart'] + ":" + oErr['nEnd'] + "  # " + oErr['sRuleId']+"  : ";
        s += oErr["sMessage"];
        if (oErr["aSuggestions"].length > 0) {
            s += "\n  > Suggestions : " + oErr["aSuggestions"].join(" | ");
        }
        if (oErr["URL"] !== "") {
            s += "\n  > URL: " + oErr["URL"];
        }
        return s;







|
|







35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
    }
    yield sText;
}

function getReadableError (oErr) {
    // Returns an error oErr as a readable error
    try {
        let s = "\n* " + oErr['nStart'] + ":" + oErr['nEnd'] + "  # " + oErr['sRuleId']+":\n";
        s += "  " + oErr["sMessage"];
        if (oErr["aSuggestions"].length > 0) {
            s += "\n  > Suggestions : " + oErr["aSuggestions"].join(" | ");
        }
        if (oErr["URL"] !== "") {
            s += "\n  > URL: " + oErr["URL"];
        }
        return s;

Modified gc_core/py/text.py from [af72c36707] to [e964ece40d].

81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
        nOffset += ln
    return sText


def getReadableError (dErr):
    "Returns an error dErr as a readable error"
    try:
        s = u"* {nStart}:{nEnd}  # {sLineId} / {sRuleId} : ".format(**dErr)
        s += dErr.get("sMessage", "# error : message not found")
        if dErr.get("aSuggestions", None):
            s += "\n  > Suggestions : " + " | ".join(dErr.get("aSuggestions", "# error : suggestions not found"))
        if dErr.get("URL", None):
            s += "\n  > URL: " + dErr["URL"]
        return s
    except KeyError:
        return u"* Non-compliant error: {}".format(dErr)







|
|







81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
        nOffset += ln
    return sText


def getReadableError (dErr):
    "Returns an error dErr as a readable error"
    try:
        s = u"* {nStart}:{nEnd}  # {sLineId} / {sRuleId}:\n".format(**dErr)
        s += "  " + dErr.get("sMessage", "# error : message not found")
        if dErr.get("aSuggestions", None):
            s += "\n  > Suggestions : " + " | ".join(dErr.get("aSuggestions", "# error : suggestions not found"))
        if dErr.get("URL", None):
            s += "\n  > URL: " + dErr["URL"]
        return s
    except KeyError:
        return u"* Non-compliant error: {}".format(dErr)