summaryrefslogtreecommitdiff
path: root/apps/win_main.c
diff options
context:
space:
mode:
authorTor Andersson <tor@ghostscript.com>2011-03-06 15:14:33 +0000
committerTor Andersson <tor@ghostscript.com>2011-03-06 15:14:33 +0000
commit538d304ab289364510eaff37308bb8f4d6293d7b (patch)
treeb97e20cf1a0aa66facd92dd46b7b94aa4bbbdc6d /apps/win_main.c
parentb5a4ed89c89dd94b21f4c9936abc2567a1553555 (diff)
downloadmupdf-538d304ab289364510eaff37308bb8f4d6293d7b.tar.xz
Add error message buffer for GUI applications to display the latest error stack trace.
Diffstat (limited to 'apps/win_main.c')
-rw-r--r--apps/win_main.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/apps/win_main.c b/apps/win_main.c
index d3dbb3f8..e217dfbb 100644
--- a/apps/win_main.c
+++ b/apps/win_main.c
@@ -48,9 +48,20 @@ void winwarn(pdfapp_t *app, char *msg)
void winerror(pdfapp_t *app, fz_error error)
{
+ char msgbuf[160 * 30];
+ int i;
+
/* TODO: redirect stderr to a log file and display here */
fz_catch(error, "displaying error message to user");
- MessageBoxA(hwndframe, "An error has occurred.", "MuPDF: Error", MB_ICONERROR);
+
+ fz_strlcpy(msgbuf, "An error has occurred.\n\n", sizeof msgbuf);
+ for (i = 0; i < fz_geterrorcount(); i++)
+ {
+ fz_strlcat(msgbuf, fz_geterrorline(i), sizeof msgbuf);
+ fz_strlcat(msgbuf, "\n", sizeof msgbuf);
+ }
+
+ MessageBoxA(hwndframe, msgbuf, "MuPDF: Error", MB_ICONERROR);
exit(1);
}