Commit 8e652730 authored by Dridi Boukelmoune's avatar Dridi Boukelmoune

vrt: Log the proper vre error message

parent 92e70068
...@@ -64,6 +64,8 @@ VPI_re_fini(vre_t *rep) ...@@ -64,6 +64,8 @@ VPI_re_fini(vre_t *rep)
VCL_BOOL VCL_BOOL
VRT_re_match(VRT_CTX, const char *s, VCL_REGEX re) VRT_re_match(VRT_CTX, const char *s, VCL_REGEX re)
{ {
struct vsb vsb[1];
char errbuf[VRE_ERROR_LEN];
int i; int i;
CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);
...@@ -73,8 +75,13 @@ VRT_re_match(VRT_CTX, const char *s, VCL_REGEX re) ...@@ -73,8 +75,13 @@ VRT_re_match(VRT_CTX, const char *s, VCL_REGEX re)
i = VRE_match(re, s, 0, 0, &cache_param->vre_limits); i = VRE_match(re, s, 0, 0, &cache_param->vre_limits);
if (i >= 0) if (i >= 0)
return (1); return (1);
if (i < VRE_ERROR_NOMATCH ) if (i < VRE_ERROR_NOMATCH ) {
VRT_fail(ctx, "Regexp matching returned %d", i); VSB_init(vsb, errbuf, sizeof errbuf);
AZ(VRE_error(vsb, i));
AZ(VSB_finish(vsb));
VSB_fini(vsb);
VRT_fail(ctx, "Regexp matching failed: %s", errbuf);
}
return (0); return (0);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment