af565cdd7cea645c67aea9bf91ac0fa50caf6871 max Tue Nov 24 10:29:05 2015 -0800 adding hg.conf option to suppress error output for very early errors refs #16439 diff --git src/lib/htmshell.c src/lib/htmshell.c index 5786bad..b1a5807 100644 --- src/lib/htmshell.c +++ src/lib/htmshell.c @@ -12,30 +12,39 @@ #include "common.h" #include "obscure.h" #include "cheapcgi.h" #include "htmshell.h" #include "errAbort.h" #include "dnautil.h" jmp_buf htmlRecover; boolean htmlWarnBoxSetUpAlready=FALSE; static bool NoEscape = FALSE; +static bool errorsNoHeader = FALSE; + +void htmlSuppressErrors() +/* Do not output a http header for error messages. Makes sure that very early + * errors are not shown back to the user but trigger a 500 error, */ +{ +errorsNoHeader = TRUE; +} + void htmlNoEscape() { NoEscape = TRUE; } void htmlDoEscape() { NoEscape = FALSE; } void htmlVaParagraph(char *line, va_list args) /* Print a line in it's own paragraph. */ { fputs("<P>", stdout); vfprintf(stdout, line, args); @@ -305,31 +314,31 @@ void htmlAbort() /* Terminate HTML file. */ { longjmp(htmlRecover, -1); } void htmlMemDeath() { errAbort("Out of memory."); } static void earlyWarningHandler(char *format, va_list args) /* Write an error message so user can see it before page is really started. */ { static boolean initted = FALSE; -if (!initted) +if (!initted && !errorsNoHeader) { htmlStart("Very Early Error"); initted = TRUE; } printf("%s", htmlWarnStartPattern()); htmlVaParagraph(format,args); printf("%s", htmlWarnEndPattern()); } static void earlyAbortHandler() /* Exit close web page during early abort. */ { printf("</BODY></HTML>"); exit(0); }