Permalink
Browse files

ENH: regExp: improved error message

  • Loading branch information...
1 parent 83c7bc2 commit 6866092b5062170b6253b271c4d3ac8706b15822 mattijs committed Oct 25, 2012
Showing with 7 additions and 1 deletion.
  1. +7 −1 src/OSspecific/POSIX/regExp.C
@@ -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);
}
}

0 comments on commit 6866092

Please sign in to comment.