Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

ENH: regExp: improved error message

  • Loading branch information...
commit 6866092b5062170b6253b271c4d3ac8706b15822 1 parent 83c7bc2
authored October 25, 2012

Showing 1 changed file with 7 additions and 1 deletion. Show diff stats Hide diff stats

  1. 8  src/OSspecific/POSIX/regExp.C
8  src/OSspecific/POSIX/regExp.C
@@ -80,12 +80,18 @@ void Foam::regExp::set(const char* pattern, const bool ignoreCase) const
80 80
             cflags |= REG_ICASE;
81 81
         }
82 82
 
83  
-        if (regcomp(preg_, pattern, cflags) != 0)
  83
+        int err = regcomp(preg_, pattern, cflags);
  84
+        
  85
+        if (err != 0)
84 86
         {
  87
+            char errbuf[200];
  88
+            regerror(err, preg_, errbuf, sizeof(errbuf));
  89
+
85 90
             FatalErrorIn
86 91
             (
87 92
                 "regExp::set(const char*)"
88 93
             )   << "Failed to compile regular expression '" << pattern << "'"
  94
+                << nl << errbuf
89 95
                 << exit(FatalError);
90 96
         }
91 97
     }

0 notes on commit 6866092

Please sign in to comment.
Something went wrong with that request. Please try again.