Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit325aeaa

Browse files
jdufresnegsnedders
authored andcommitted
Add useful message to the ParseError exception.
Sometimes, I would like to be able to catch ParseError, and output itsmessage immediately. Set the exception's message to the parser errormessage.
1 parentf644865 commit325aeaa

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

‎html5lib/html5parser.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
from .constantsimporttokenTypes,ReparseException,namespaces
1919
from .constantsimporthtmlIntegrationPointElements,mathmlTextIntegrationPointElements
2020
from .constantsimportadjustForeignAttributesasadjustForeignAttributesMap
21+
from .constantsimportE
2122

2223

2324
defparse(doc,treebuilder="etree",encoding=None,
@@ -256,7 +257,7 @@ def parseError(self, errorcode="XXX-undefined-error", datavars={}):
256257
# XXX The idea is to make errorcode mandatory.
257258
self.errors.append((self.tokenizer.stream.position(),errorcode,datavars))
258259
ifself.strict:
259-
raiseParseError
260+
raiseParseError(E[errorcode]%datavars)
260261

261262
defnormalizeToken(self,token):
262263
""" HTML5 specific normalizations to the token stream """

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp