refactor: made the error messages for replacement template compilation failures less verbose in ngx.re.sub and ngx.re.gsub.

This commit is contained in:
agentzh (Yichun Zhang) 2013-05-13 18:09:08 -07:00
Родитель bd679f20ef
Коммит 603c7a4796
3 изменённых файлов: 13 добавлений и 14 удалений

Просмотреть файл

@ -1518,8 +1518,7 @@ ngx_http_lua_ngx_re_sub_helper(lua_State *L, unsigned global)
lua_pushnil(L);
lua_pushnil(L);
lua_pushfstring(L, "bad template for substitution: \"%s\"",
lua_tostring(L, 3));
lua_pushliteral(L, "failed to compile the replacement template");
return 3;
}
}

Просмотреть файл

@ -85,7 +85,7 @@ a [b c] [b] [c] [] [] d
--- request
GET /re
--- response_body
error: bad template for substitution: "[$0] [$1] [$2] [$3] [$hello]"
error: failed to compile the replacement template
--- error_log
attempt to use named capturing variable "hello" (named captures not supported yet)
@ -107,7 +107,7 @@ attempt to use named capturing variable "hello" (named captures not supported ye
--- request
GET /re
--- response_body
error: bad template for substitution: "[$0] [$1] [$2] [$3] [${hello}]"
error: failed to compile the replacement template
--- error_log
attempt to use named capturing variable "hello" (named captures not supported yet)
@ -145,7 +145,7 @@ attempt to use named capturing variable "hello" (named captures not supported ye
--- request
GET /re
--- response_body
error: bad template for substitution: "[$0] [$1] [${2}] [$3] [${134]"
error: failed to compile the replacement template
--- error_log
the closing bracket in "134" variable is missing
@ -166,7 +166,7 @@ the closing bracket in "134" variable is missing
--- request
GET /re
--- response_body
error: bad template for substitution: "[$0] [$1] [${2}] [$3] [${134"
error: failed to compile the replacement template
--- error_log
the closing bracket in "134" variable is missing
@ -187,7 +187,7 @@ the closing bracket in "134" variable is missing
--- request
GET /re
--- response_body
error: bad template for substitution: "[$0] [$1] [${2}] [$3] [${"
error: failed to compile the replacement template
--- error_log
lua script: invalid capturing variable name found in "[$0] [$1] [${2}] [$3] [${"
@ -208,7 +208,7 @@ lua script: invalid capturing variable name found in "[$0] [$1] [${2}] [$3] [${"
--- request
GET /re
--- response_body
error: bad template for substitution: "[$0] [$1] [${2}] [$3] [$"
error: failed to compile the replacement template
--- error_log
lua script: invalid capturing variable name found in "[$0] [$1] [${2}] [$3] [$"

Просмотреть файл

@ -87,7 +87,7 @@ a [b c] [b] [c] [] [] d
--- request
GET /re
--- response_body
error: bad template for substitution: "[$0] [$1] [$2] [$3] [$hello]"
error: failed to compile the replacement template
--- error_log
attempt to use named capturing variable "hello" (named captures not supported yet)
@ -111,7 +111,7 @@ attempt to use named capturing variable "hello" (named captures not supported ye
--- request
GET /re
--- response_body
error: bad template for substitution: "[$0] [$1] [$2] [$3] [${hello}]"
error: failed to compile the replacement template
--- error_log
attempt to use named capturing variable "hello" (named captures not supported yet)
@ -149,7 +149,7 @@ attempt to use named capturing variable "hello" (named captures not supported ye
--- request
GET /re
--- response_body
error: bad template for substitution: "[$0] [$1] [${2}] [$3] [${134]"
error: failed to compile the replacement template
--- error_log
the closing bracket in "134" variable is missing
@ -170,7 +170,7 @@ the closing bracket in "134" variable is missing
--- request
GET /re
--- response_body
error: bad template for substitution: "[$0] [$1] [${2}] [$3] [${134"
error: failed to compile the replacement template
--- error_log
the closing bracket in "134" variable is missing
@ -191,7 +191,7 @@ the closing bracket in "134" variable is missing
--- request
GET /re
--- response_body
error: bad template for substitution: "[$0] [$1] [${2}] [$3] [${"
error: failed to compile the replacement template
--- error_log
lua script: invalid capturing variable name found in "[$0] [$1] [${2}] [$3] [${"
@ -212,7 +212,7 @@ lua script: invalid capturing variable name found in "[$0] [$1] [${2}] [$3] [${"
--- request
GET /re
--- response_body
error: bad template for substitution: "[$0] [$1] [${2}] [$3] [$"
error: failed to compile the replacement template
--- error_log
lua script: invalid capturing variable name found in "[$0] [$1] [${2}] [$3] [$"