react-native-html-parser
react-native-html-parser copied to clipboard
How to catch a parse exception
The React Native ExceptionsManager is showing the following exception when trying to parse an invalid HTML document which contains not properly closed tags.
[xmldom fatalError] end tag name: tr is not match the current start tagName:table
@#[line:370,col:76]
How can I capture the exception to prevent the application from crashing?
@sgimeno
Just try to override the errorHandler
:
new DOMParser({
errorHandler: {
warning: w => console.warn(w),
error: e => console.log(e),
fatalError: e => console.log(e),
},
})