-
Notifications
You must be signed in to change notification settings - Fork 607
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Malformed xml not detected in callback #408
Comments
I agree, this definitely should happen! Error handling is currently extremely bad. |
See #67 |
Test code to reproduce issue: const xml2js = require('xml2js');
let xml = `<Transaction /> <Transaction /> </confirmation>`;
try {
xml2js.parseString(xml, (err, res) => {
console.log('callback err:');
console.log(err);
console.log('callback res:');
console.log(res);
});
}
catch (err) {
console.log('caught err:');
console.log(err);
} Output (paths in stacktrace sanitized):
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi, I am using parseString to parse a string that looks like this:
<Transaction /> <Transaction /> </confirmation>
using code that looks like this
parseString(xml, function (err, res) {});
A malformed xml error is thrown, but only after the callback is triggered and the err variable is null and the res variable is an object containing Transaction tag data.
Wouldn't it be better to get the error in the callback?
The text was updated successfully, but these errors were encountered: