From 5a8c5eb4791677526d8f20a6c36077b78e9e6f4a Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer <akohlmey@gmail.com> Date: Mon, 6 Nov 2017 10:41:01 -0500 Subject: [PATCH] provide last input command line with error->one() output --- src/error.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/error.cpp b/src/error.cpp index 0969507fc9..9193314fc8 100644 --- a/src/error.cpp +++ b/src/error.cpp @@ -115,10 +115,10 @@ void Error::all(const char *file, int line, const char *str) if (me == 0) { if (input && input->line) lastcmd = input->line; if (screen) fprintf(screen,"ERROR: %s (%s:%d)\n" - "Last command: %s\n", + "Last command: %s\n", str,file,line,lastcmd); if (logfile) fprintf(logfile,"ERROR: %s (%s:%d)\n" - "Last command: %s\n", + "Last command: %s\n", str,file,line,lastcmd); } @@ -152,9 +152,17 @@ void Error::all(const char *file, int line, const char *str) void Error::one(const char *file, int line, const char *str) { int me; + const char *lastcmd = (const char*)"(unknown)"; MPI_Comm_rank(world,&me); - if (screen) fprintf(screen,"ERROR on proc %d: %s (%s:%d)\n", - me,str,file,line); + + if (input && input->line) lastcmd = input->line; + if (screen) fprintf(screen,"ERROR on proc %d: %s (%s:%d)\n" + "Last command: %s\n", + me,str,file,line,lastcmd); + if (logfile) fprintf(logfile,"ERROR on proc %d: %s (%s:%d)\n" + "Last command: %s\n", + me,str,file,line,lastcmd); + if (universe->nworlds > 1) if (universe->uscreen) fprintf(universe->uscreen,"ERROR on proc %d: %s (%s:%d)\n", -- GitLab