Skip to content
This repository has been archived by the owner on Dec 12, 2024. It is now read-only.

Invalid XML kills process #10

Open
arixol opened this issue Dec 20, 2017 · 1 comment
Open

Invalid XML kills process #10

arixol opened this issue Dec 20, 2017 · 1 comment

Comments

@arixol
Copy link

arixol commented Dec 20, 2017

When fast-xml2js is given invalid XML syntax, it kills the process, rather than catching the error and logging it.

Invalid XML example:

<UserName>asdf</UserName/>

Usage example:

import { parseString } from 'fast-xml2js'
...
export const parseXML = (str, opts) => {
    return new Promise((resolve, reject) => {
        parseString(str, (err, rst) => {
            if (err) {
                logger.error('Error parsing XML file')
                reject(err)
            } else {
                resolve(rst)
            }
        })
    })
}

When xml2js encounters the same syntax, it throws the following error:

Error: Invalid tagname in closing tag
Line: 2
Column: 37
Char: /
@cmrigney
Copy link
Owner

@arixol Thanks for reporting this. I'll take a look and see what's happening when I get the chance. In the mean time, feel free to submit a PR. Thanks.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants