src/lib/errabort.c 1.16
1.16 2010/01/12 18:16:27 markd
added horrible hack so it's possible to distinguish between warning and errors in the warn handler
Index: src/lib/errabort.c
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/lib/errabort.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -b -B -U 4 -r1.15 -r1.16
--- src/lib/errabort.c 7 Jun 2009 07:13:37 -0000 1.15
+++ src/lib/errabort.c 12 Jan 2010 18:16:27 -0000 1.16
@@ -17,8 +17,11 @@
static char const rcsid[] = "$Id$";
static boolean debugPushPopErr = FALSE; // generate stack dump on push/pop error
+boolean errAbortInProgress = FALSE; /* Flag to indicate that an error abort is in progress.
+ * Needed so that a warn handler can tell if it's really
+ * being called because of a warning or an error. */
static void defaultVaWarn(char *format, va_list args)
/* Default error message handler. */
{
@@ -107,8 +110,14 @@
void vaErrAbort(char *format, va_list args)
/* Abort function, with optional (vprintf formatted) error message. */
{
+/* flag is needed because both errAbort and warn generate message
+ * using the warn handler, however sometimes one needed to know
+ * (like when logging), if it's an error or a warning. This is far from
+ * perfect, as this isn't cleared if the error handler continues,
+ * as with an exception mechanism. */
+errAbortInProgress = TRUE;
vaWarn(format, args);
noWarnAbort();
}