Commits

Anonymous committed 1272fa6

Let errors propogate better
Log:
Submitted by:
Reviewed by:
PR:

  • Participants
  • Parent commits 645653c

Comments (0)

Files changed (2)

         xmlXPathObjectPtr found = NULL;
         xmlNodeSetPtr nodelist = NULL;
         SV* element = NULL ;
+        STRLEN n_a;
         STRLEN len = 0 ;
         xmlChar * xpath = nodeSv2C(pxpath, node);
     INIT:
             }
             xmlXPathFreeObject(found);
         }
+        else {
+            LibXML_croak_error();
+        }
 
 void
 _findnodes( pnode, perl_xpath )
             }
             xmlXPathFreeNodeSet( nodelist );
         }
+        else {
+            LibXML_croak_error();
+        }
 
 void
 getNamespaces( pnode )

File perl-libxml-sax.c

 
     perl_call_method( "start_prefix_mapping", G_SCALAR | G_EVAL );
     sv_2mortal(rv);
+    if (SvTRUE(ERRSV)) {
+        STRLEN n_a;
+        POPs;
+        croak(SvPV(ERRSV, n_a));
+    }
     FREETMPS ;
     LEAVE ;
 }
     PUTBACK;
 
     perl_call_method( "end_prefix_mapping", G_SCALAR | G_EVAL );
-
     sv_2mortal(rv);
-
+    if (SvTRUE(ERRSV)) {
+        STRLEN n_a;
+        POPs;
+        croak(SvPV(ERRSV, n_a));
+    }
+    
     FREETMPS ;
     LEAVE ;
 }
         PUTBACK;
         
         count = perl_call_method( "start_document", G_SCALAR | G_EVAL );
+        if (SvTRUE(ERRSV)) {
+            STRLEN n_a;
+            POPs;
+            croak(SvPV(ERRSV, n_a));
+        }
         
         SPAGAIN;
 
         
         count = perl_call_method( "xml_decl", G_SCALAR | G_EVAL );
         sv_2mortal(rv);
-
+        if (SvTRUE(ERRSV)) {
+            STRLEN n_a;
+            POPs;
+            croak(SvPV(ERRSV, n_a));
+        }
+        
         FREETMPS ;
         LEAVE ;
     }
     PUTBACK;
 
     count = perl_call_pv( "XML::LibXML::_SAXParser::end_document", G_SCALAR | G_EVAL );
-
+    if (SvTRUE(ERRSV)) {
+        STRLEN n_a;
+        POPs;
+        croak(SvPV(ERRSV, n_a));
+    }
+    
     FREETMPS ;
     LEAVE ;
 
     PUTBACK;
 
     count = perl_call_method( "start_element", G_SCALAR | G_EVAL );
+    sv_2mortal(rv) ;
+
+    if (SvTRUE(ERRSV)) {
+        STRLEN n_a;
+        POPs;
+        croak(SvPV(ERRSV, n_a));
+    }
     
-    sv_2mortal(rv) ;
     FREETMPS ;
     LEAVE ;
 
     PUTBACK;
 
     count = perl_call_method( "end_element", G_SCALAR | G_EVAL );
-
     sv_2mortal(rv);
-
+    
+    if (SvTRUE(ERRSV)) {
+        STRLEN n_a;
+        POPs;
+        croak(SvPV(ERRSV, n_a));
+    }
+    
     FREETMPS ;
     LEAVE ;
 
         PUTBACK;
 
         count = perl_call_method( "characters", G_SCALAR | G_EVAL );
-
         sv_2mortal(rv);
-
+        
+        if (SvTRUE(ERRSV)) {
+            STRLEN n_a;
+            POPs;
+            croak(SvPV(ERRSV, n_a));
+        }
+        
         FREETMPS ;
         LEAVE ;
 
         PUTBACK;
 
         count = perl_call_method( "comment", G_SCALAR | G_EVAL );
-
         sv_2mortal(rv);
-
+        
+        if (SvTRUE(ERRSV)) {
+            STRLEN n_a;
+            POPs;
+            croak(SvPV(ERRSV, n_a));
+        }
+        
         FREETMPS ;
         LEAVE ;
 
         XPUSHs(handler);
         PUTBACK;
         count = perl_call_method( "start_cdata", G_SCALAR | G_EVAL );
-
+        if (SvTRUE(ERRSV)) {
+            STRLEN n_a;
+            POPs;
+            croak(SvPV(ERRSV, n_a));
+        }
+        
         SPAGAIN;        
         PUSHMARK(SP) ;
     
         PUTBACK;
 
         count = perl_call_method( "characters", G_SCALAR | G_EVAL );
-
+        if (SvTRUE(ERRSV)) {
+            STRLEN n_a;
+            POPs;
+            croak(SvPV(ERRSV, n_a));
+        }
+        
         SPAGAIN;        
         PUSHMARK(SP) ;
     
         PUTBACK;
 
         count = perl_call_method( "end_cdata", G_SCALAR | G_EVAL );
-
         sv_2mortal(rv);
-
+        
+        if (SvTRUE(ERRSV)) {
+            STRLEN n_a;
+            POPs;
+            croak(SvPV(ERRSV, n_a));
+        }
+        
         FREETMPS ;
         LEAVE ;
 
 
         sv_2mortal(rv);
 
+        if (SvTRUE(ERRSV)) {
+            STRLEN n_a;
+            POPs;
+            croak(SvPV(ERRSV, n_a));
+        }
+        
         FREETMPS ;
         LEAVE ;
     }
     PUTBACK;
 
     perl_call_pv( "XML::LibXML::_SAXParser::warning", G_SCALAR | G_EVAL );
+    if (SvTRUE(ERRSV)) {
+        STRLEN n_a;
+        POPs;
+        croak(SvPV(ERRSV, n_a));
+    }
     
     FREETMPS ;
     LEAVE ;
     XPUSHs(sv_2mortal(newSViv(ctxt->input->col)));
     PUTBACK;
     perl_call_pv( "XML::LibXML::_SAXParser::error", G_SCALAR | G_EVAL );
+    if (SvTRUE(ERRSV)) {
+        STRLEN n_a;
+        POPs;
+        croak(SvPV(ERRSV, n_a));
+    }
     
     FREETMPS ;
     LEAVE ;
     XPUSHs(sv_2mortal(newSViv(ctxt->input->col)));
     PUTBACK;
     perl_call_pv( "XML::LibXML::_SAXParser::fatal_error", G_SCALAR | G_EVAL );
+    if (SvTRUE(ERRSV)) {
+        STRLEN n_a;
+        POPs;
+        croak(SvPV(ERRSV, n_a));
+    }
     
     FREETMPS ;
     LEAVE ;