[format] point out the location of a pcre-compile error

Defect Number:
    Reviewed By:
   Testing Done:
pull/356/head
Timothy Stack 8 years ago
parent d9b5cf3856
commit 9f79dcc31a

@ -1342,6 +1342,15 @@ void external_log_format::build(std::vector<std::string> &errors) {
iter->first + "]" +
":" +
e.what());
errors.push_back("error:" +
this->elf_name.to_string() + ".regex[" +
iter->first + "]" +
":" + pat.p_string);
errors.push_back("error:" +
this->elf_name.to_string() + ".regex[" +
iter->first + "]" +
":" + string(e.e_offset, ' ') +
"^");
continue;
}
for (pcre_named_capture::iterator name_iter = pat.p_pcre->named_begin();

@ -528,7 +528,7 @@ public:
} while (length > 0);
return length;
}
};
#ifdef PCRE_STUDY_JIT_COMPILE
static pcre_jit_stack *jit_stack(void);

@ -10,6 +10,8 @@ sed -i "" -e "s|/.*/init.sql|init.sql|g" `test_err_filename`
check_error_output "invalid format not detected?" <<EOF
error:bad_regex_log.regex[std]:missing )
error:bad_regex_log.regex[std]:^(?<timestamp>\d+: (?<body>.*)$
error:bad_regex_log.regex[std]: ^
error:bad_regex_log.level:missing )
error:bad_regex_log:invalid sample -- 1428634687123; foo
error:bad_sample_log:invalid sample -- 1428634687123; foo bar

Loading…
Cancel
Save