DescriptionThis patch returns a bare-bones DOM that includes error info from a DOMException generated by parsing invalid text. The purpose is to echo the error text back to a gadget developer rather than obscure it without any context.
The implementation isn't perfect in that it would arguably be better for MutableContent.getDocument() to throw a suitable Exception on parse failure. However, doing so changes the MutableContent API to throw a checked Exception, which could force several downstream API changes. An alternative would be to add a MutableContent.checkDocument() API that does throw an exception, whose use would be isolated to HtmlRenderer. This forces DOM parsing before any rewriters are run, however, which has non-trivial performance impact when String-based rewriters are run.
This implementation's main semantic downside is that the status code returned for an erroring-render is 200 rather than 404.
Input welcome.
Patch Set 1 #Patch Set 2 : Test fix and small cleanup. #
MessagesTotal messages: 2
|