[folia] Let xpath() fail more informatively
asharkinasuit opened this issue · 1 comments
asharkinasuit commented
Right now, the XML tree is discarded unless mode=XPATH
was a keyword argument. If the xpath
function is called on a document not in this mode, it fails with AttributeError: 'NoneType' object has no attribute 'xpath'
, which can be confusing. It's probably easy and good practice to check the mode in that method before trying to make the call that can lead to that error, and raise a more informative exception when appropriate.
proycon commented
Right, good point!