      (.close parser)
 
      (or (:success @result)
-         (throw (js/Error. (:error @result)))))))
+         (throw (ex-info (str (:error @result)) {}))))))

      (conj (rest (rest document)) new-father))
    document))

(defn- add-text [text document]
  (if (not (empty? text))
    (let [current-node (first document)
          node-children (:content current-node)

                 lowercase true
                 position true
                 strict-entities false}}]
   (let [parser (.parser js/sax strict #js {"trim" trim
                                            "normalize" normalize
                                            "lowercase" lowercase
                                            "xmlns" xmlns
                                            "position" position
                                            "strictEntities" strict-entities})
         document (atom (new-document))
         result (atom nil)]
     ;; OPEN TAG
