Considerable improvement of --parse-errors (and patch)

This commit is contained in:
Miroslav Stampar
2019-06-06 12:13:30 +02:00
parent 0e409d4479
commit 677dd20d6c
2 changed files with 5 additions and 2 deletions

View File

@@ -2651,12 +2651,15 @@ def extractErrorMessage(page):
retVal = None
if isinstance(page, six.string_types):
if wasLastResponseDBMSError():
page = re.sub(r"<[^>]+>", "", page)
for regex in ERROR_PARSING_REGEXES:
match = re.search(regex, page, re.IGNORECASE)
if match:
candidate = htmlUnescape(match.group("result")).replace("<br>", "\n").strip()
if re.search(r"\b([a-z]+ ){5}", candidate) is None: # check for legitimate (e.g. Warning:...) text
if re.search(r"\b([a-z]+ ){5}", candidate) is not None: # check for legitimate (e.g. Warning:...) text
retVal = candidate
break