title: Clojure exception handling
body: <p>I'm having some issues with <strong>clojure.data.xml</strong> in that when parsing bad XML, the exception thrown is not caught. I've found some issues perhaps with run-time wrappers, but my attempts to unwrap it have been unsuccessful can anyone point out to me why this may be happening?</p>
  
  <pre><code>(defn parse-xml-from-string
    "takes in valid xml as a string and turns it into 
     #clojure.data.xml data, if bad xml returns false"
    [xml]
    (try
      (do (parse (java.io.StringReader. xml)))
      (catch javax.xml.stream.XMLStreamException e false)
      (catch Exception ex
        (cond (isa? (class (.getCause ex)) javax.xml.stream.XMLStreamException) false))))
  </code></pre>
  
  <p>method call</p>
  
  <pre><code>(viva-api.helpers.validation/parse-xml-from-string "&lt;?xml version=\"1.0\"encoding=\"UTF-8\"?&gt;&lt;foo&gt;&lt;bar&gt;&lt;baz&gt;The baz value&lt;/baz&gt;&lt;/bar&gt;&lt;/foos&gt;")
  </code></pre>
  
  <p>output</p>
  
  <pre><code>#clojure.data.xml.Element{:tag :foo, :attrs {}, :content (user=&gt; XMLStreamException  ParseError at [row,col]:[1,84]
  Message: The end-tag for element type "foo" must end with a '&gt;' delimiter.  com.sun.org.apache.xerces.internal.impl.XMLStreamReaderImpl.next (XMLStreamReaderImpl.java:598)
  </code></pre>