[xml] Structured error handling patch



Hi,

I'd like to suggest a small patch to structured error handling.

The idea is to set xmlLastError even when __xmlRaiseError
has a parser context available.

Otherwise, you never get access to the error when doing things like:

if (NULL == xmlReadFile("doesNotExist.xml",NULL,0))
{
        printf("%s",xmlGetLastError()->message);
}

Happy new year.

-sbi

Index: error.c
===================================================================
RCS file: /cvs/gnome/gnome-xml/error.c,v
retrieving revision 1.65
diff -c -r1.65 error.c
*** error.c     8 Dec 2003 17:41:28 -0000       1.65
--- error.c     2 Jan 2004 18:28:47 -0000
***************
*** 537,542 ****
--- 537,545 ----
      to->node = node;
      to->ctxt = ctx;

+     if (to != &xmlLastError)
+         xmlCopyError(to,&xmlLastError);
+
      /*
       * Find the callback channel.
       */




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]