hw/xwin: Show any fatal error message
Report the fatal error message in the dialog we pop up, rather than just referring the user to the logfile. v2: Do this a better way since the "Pass the FatalError message to OsVendorFatalError" patch has landed, and OsVendorFatalError() now gets passed the fatal error message Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk> Reviewed-by: Colin Harrison <colin.harrison@virgin.net>
This commit is contained in:
parent
6a6c3afe71
commit
5824166256
|
@ -59,15 +59,16 @@ OsVendorVErrorF(const char *pszFormat, va_list va_args)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* os/util.c/FatalError () calls our vendor ErrorF, so the message
|
* os/log.c:FatalError () calls our vendor ErrorF, so the message
|
||||||
* from a FatalError will be logged. Thus, the message for the
|
* from a FatalError will be logged.
|
||||||
* fatal error is not passed to this function.
|
|
||||||
*
|
*
|
||||||
* Attempt to do last-ditch, safe, important cleanup here.
|
* Attempt to do last-ditch, safe, important cleanup here.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
OsVendorFatalError(const char *f, va_list args)
|
OsVendorFatalError(const char *f, va_list args)
|
||||||
{
|
{
|
||||||
|
char errormsg[1024] = "";
|
||||||
|
|
||||||
/* Don't give duplicate warning if UseMsg was called */
|
/* Don't give duplicate warning if UseMsg was called */
|
||||||
if (g_fSilentFatalError)
|
if (g_fSilentFatalError)
|
||||||
return;
|
return;
|
||||||
|
@ -78,9 +79,28 @@ OsVendorFatalError(const char *f, va_list args)
|
||||||
}
|
}
|
||||||
LogClose(EXIT_ERR_ABORT);
|
LogClose(EXIT_ERR_ABORT);
|
||||||
|
|
||||||
winMessageBoxF("A fatal error has occurred and " PROJECT_NAME
|
/* Format the error message */
|
||||||
" will now exit.\n" "Please open %s for more information.\n",
|
vsnprintf(errormsg, sizeof(errormsg), f, args);
|
||||||
MB_ICONERROR, (g_pszLogFile ? g_pszLogFile : "the logfile"));
|
|
||||||
|
/*
|
||||||
|
Sometimes the error message needs a bit of cosmetic cleaning
|
||||||
|
up for use in a dialog box...
|
||||||
|
*/
|
||||||
|
{
|
||||||
|
char *s;
|
||||||
|
|
||||||
|
while ((s = strstr(errormsg, "\n\t")) != NULL) {
|
||||||
|
s[0] = ' ';
|
||||||
|
s[1] = '\n';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
winMessageBoxF("A fatal error has occurred and " PROJECT_NAME " will now exit.\n\n"
|
||||||
|
"%s\n\n"
|
||||||
|
"Please open %s for more information.\n",
|
||||||
|
MB_ICONERROR,
|
||||||
|
errormsg,
|
||||||
|
(g_pszLogFile ? g_pszLogFile : "the logfile"));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in New Issue