Skip to content

Commit 6805515

Browse files
committed
bugfix: ngx.re: fixed the error stacktrace level when missing PCRE support.
Since we override the `require` function in `resty.base`, the proper stacktrace level for this error is 3 since it is thrown in the main chunk of the module. Example: Previously, the previous behavior with `resty` was: $ resty -e 'require "ngx.re"' ERROR: no support for 'ngx.re' module: OpenResty was compiled without PCRE support stack traceback: ... Now, the error contains the chunkame `(command line -e):1:`: $ resty -e 'require "ngx.re"' ERROR: (command line -e):1: no support for 'ngx.re' module: OpenResty was compiled without PCRE support stack traceback: ... Which is similar to the error reported by other `ngx.re` APIs when attempting to use them without PCRE support: $ resty -e 'ngx.re.gmatch()' ERROR: (command line -e):1: no support for 'ngx.re.gmatch': OpenResty was compiled without PCRE support stack traceback: ...
1 parent 1985bf8 commit 6805515

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/ngx/re.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ local core_regex = require "resty.core.regex"
1010

1111
if core_regex.no_pcre then
1212
error("no support for 'ngx.re' module: OpenResty was " ..
13-
"compiled without PCRE support", 2)
13+
"compiled without PCRE support", 3)
1414
end
1515

1616

0 commit comments

Comments
 (0)