regex: align query/regex err pos in optional err messages/panics
parent
02ba923ba7
commit
d0a2992335
|
@ -7,11 +7,11 @@ pub fn (mut re RE) compile_opt(pattern string) ? {
|
||||||
|
|
||||||
if re_err != compile_ok {
|
if re_err != compile_ok {
|
||||||
mut err_msg := strings.new_builder(300)
|
mut err_msg := strings.new_builder(300)
|
||||||
err_msg.write("query: $pattern\n")
|
|
||||||
line := "-".repeat(err_pos)
|
|
||||||
err_msg.write("err : ${line}^\n")
|
|
||||||
err_str := re.get_parse_error_string(re_err)
|
err_str := re.get_parse_error_string(re_err)
|
||||||
err_msg.write("ERROR: $err_str\n")
|
err_msg.write("$err_str\n")
|
||||||
|
err_msg.write(" query: $pattern\n")
|
||||||
|
line := "-".repeat(err_pos)
|
||||||
|
err_msg.write(" err pos: ${line}^")
|
||||||
return error_with_code(err_msg.str(), re_err)
|
return error_with_code(err_msg.str(), re_err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue