Skip to content

Commit

Permalink
ENH: regExp: improved error message
Browse files Browse the repository at this point in the history
  • Loading branch information
mattijs committed Oct 25, 2012
1 parent 83c7bc2 commit 6866092
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/OSspecific/POSIX/regExp.C
Expand Up @@ -80,12 +80,18 @@ void Foam::regExp::set(const char* pattern, const bool ignoreCase) const
cflags |= REG_ICASE;
}

if (regcomp(preg_, pattern, cflags) != 0)
int err = regcomp(preg_, pattern, cflags);

if (err != 0)
{
char errbuf[200];
regerror(err, preg_, errbuf, sizeof(errbuf));

FatalErrorIn
(
"regExp::set(const char*)"
) << "Failed to compile regular expression '" << pattern << "'"
<< nl << errbuf
<< exit(FatalError);
}
}
Expand Down

0 comments on commit 6866092

Please sign in to comment.