title: Is xml2js guaranteed to be synchronous and does it throw errors?
body: <p>I am using xml2js and I need to be robust since there is no guarantee that the source of the xml is well-formed. So, I need to ensure that all errors are able to be handled. If the code looks something like this:</p>
  
  <pre><code>let parseString = require('xml2js').parseString;
  let xml = getTheXml(...);
  parseString(xml, (err, result) =&gt; {
      if (err) { handleError(err) }
      else { handleResult(result); }
  });
  </code></pre>
  
  <p>Am I guaranteed that <code>parseString</code> will never throw an error and that all errors are passed through as an <code>err</code> object to the callback?</p>
  
  <p>Or to be safer, do I need to do the following:</p>
  
  <pre><code>let parseString = require('xml2js').parseString;
  let xml = getTheXml(...);
  try {
    parseString(xml, (err, result) =&gt; {
      if (err) { handleError(err) }
      else { handleResult(result); }
    });
  } catch (err) { handleError(err); }
  </code></pre>
  
  <p>Furthermore, am I guaranteed that <code>parseString</code> executes synchronously?</p>