Skip to content
Snippets Groups Projects
Commit 5a8c5eb4 authored by Axel Kohlmeyer's avatar Axel Kohlmeyer
Browse files

provide last input command line with error->one() output

parent aa0d6cd7
No related branches found
No related tags found
No related merge requests found
...@@ -115,10 +115,10 @@ void Error::all(const char *file, int line, const char *str) ...@@ -115,10 +115,10 @@ void Error::all(const char *file, int line, const char *str)
if (me == 0) { if (me == 0) {
if (input && input->line) lastcmd = input->line; if (input && input->line) lastcmd = input->line;
if (screen) fprintf(screen,"ERROR: %s (%s:%d)\n" if (screen) fprintf(screen,"ERROR: %s (%s:%d)\n"
"Last command: %s\n", "Last command: %s\n",
str,file,line,lastcmd); str,file,line,lastcmd);
if (logfile) fprintf(logfile,"ERROR: %s (%s:%d)\n" if (logfile) fprintf(logfile,"ERROR: %s (%s:%d)\n"
"Last command: %s\n", "Last command: %s\n",
str,file,line,lastcmd); str,file,line,lastcmd);
} }
...@@ -152,9 +152,17 @@ void Error::all(const char *file, int line, const char *str) ...@@ -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) void Error::one(const char *file, int line, const char *str)
{ {
int me; int me;
const char *lastcmd = (const char*)"(unknown)";
MPI_Comm_rank(world,&me); 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->nworlds > 1)
if (universe->uscreen) if (universe->uscreen)
fprintf(universe->uscreen,"ERROR on proc %d: %s (%s:%d)\n", fprintf(universe->uscreen,"ERROR on proc %d: %s (%s:%d)\n",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment