Skip to content
Snippets Groups Projects
Commit d74fe01b authored by Christophe Geuzaine's avatar Christophe Geuzaine
Browse files

when General.AbortOnError == 2, throw the last error message, instead of 1 (see #1043)

parent ec15fd1d
No related branches found
No related tags found
No related merge requests found
...@@ -507,8 +507,6 @@ void Msg::Error(const char *fmt, ...) ...@@ -507,8 +507,6 @@ void Msg::Error(const char *fmt, ...)
_errorCount++; _errorCount++;
_atLeastOneErrorInRun = 1; _atLeastOneErrorInRun = 1;
if(GetVerbosity() < 1) return;
char str[5000]; char str[5000];
va_list args; va_list args;
va_start(args, fmt); va_start(args, fmt);
...@@ -516,12 +514,13 @@ void Msg::Error(const char *fmt, ...) ...@@ -516,12 +514,13 @@ void Msg::Error(const char *fmt, ...)
va_end(args); va_end(args);
int l = strlen(str); if(str[l-1] == '\n') str[l-1] = '\0'; int l = strlen(str); if(str[l-1] == '\n') str[l-1] = '\0';
if(_logFile) fprintf(_logFile, "Error: %s\n", str);
if(_callback) (*_callback)("Error", str);
if(_client) _client->Error(str);
if(_firstError.empty()) _firstError = str; if(_firstError.empty()) _firstError = str;
_lastError = str; _lastError = str;
if(GetVerbosity() >= 1) {
if(_logFile) fprintf(_logFile, "Error: %s\n", str);
if(_callback) (*_callback)("Error", str);
if(_client) _client->Error(str);
#if defined(HAVE_FLTK) #if defined(HAVE_FLTK)
if(FlGui::available()){ if(FlGui::available()){
FlGui::check(); FlGui::check();
...@@ -532,7 +531,6 @@ void Msg::Error(const char *fmt, ...) ...@@ -532,7 +531,6 @@ void Msg::Error(const char *fmt, ...)
(CTX::instance()->guiColorScheme ? FL_DARK_RED : FL_RED); (CTX::instance()->guiColorScheme ? FL_DARK_RED : FL_RED);
} }
#endif #endif
if(CTX::instance()->terminal){ if(CTX::instance()->terminal){
const char *c0 = "", *c1 = ""; const char *c0 = "", *c1 = "";
if(!streamIsFile(stderr) && streamIsVT100(stderr)){ if(!streamIsFile(stderr) && streamIsVT100(stderr)){
...@@ -544,9 +542,10 @@ void Msg::Error(const char *fmt, ...) ...@@ -544,9 +542,10 @@ void Msg::Error(const char *fmt, ...)
fprintf(stderr, "%sError : %s%s\n", c0, str, c1); fprintf(stderr, "%sError : %s%s\n", c0, str, c1);
fflush(stderr); fflush(stderr);
} }
}
if(CTX::instance()->abortOnError == 2) { if(CTX::instance()->abortOnError == 2) {
throw 1; throw _lastError;
} }
else if(CTX::instance()->abortOnError == 3) { else if(CTX::instance()->abortOnError == 3) {
Exit(1); Exit(1);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment