Skip to content

Commit

Permalink
dtm: Added error message details to the regular expression error hand…
Browse files Browse the repository at this point in the history
…ling
  • Loading branch information
GGRei committed Jan 23, 2024
1 parent 6da7e3d commit 083397c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions vlib/x/templating/dtm/dynamic_template_manager.v
Original file line number Diff line number Diff line change
Expand Up @@ -899,7 +899,7 @@ fn (mut tm DynamicTemplateManager) parse_html_file(file_path string, tmpl_name s
}
mut re := regex.regex_opt('.*@include(?P<space_type>[ \t\r\n]+)(?P<quote_type_beg>[\'"])(?P<path>.*)(?P<quote_type_end>[\'"])') or {
tm.stop_cache_handler()
eprintln('${dtm.message_signature_error} with regular expression for template @inclusion in parse_html_file() function. Please check the syntax of the regex pattern.')
eprintln('${dtm.message_signature_error} with regular expression for template @inclusion in parse_html_file() function. Please check the syntax of the regex pattern : ${err.msg()}')
return dtm.internat_server_error, ''
}
// Find all occurrences of the compiled regular expression within the HTML content.
Expand Down Expand Up @@ -1006,7 +1006,7 @@ fn (mut tm DynamicTemplateManager) parse_html_file(file_path string, tmpl_name s
html = html.replace_each(['\n', '', '\t', '', ' ', ' '])
mut r := regex.regex_opt(r'>(\s+)<') or {
tm.stop_cache_handler()
eprintln('${dtm.message_signature_error} with regular expression for HTML light compression in parse_html_file() function. Please check the syntax of the regex pattern.')
eprintln('${dtm.message_signature_error} with regular expression for HTML light compression in parse_html_file() function. Please check the syntax of the regex pattern : ${err.msg()}')
return dtm.internat_server_error, ''
}
html = r.replace(html, '><')
Expand Down Expand Up @@ -1055,7 +1055,7 @@ fn (mut tm DynamicTemplateManager) clean_parsed_html(tmpl string, tmpl_name stri
// Any unmatched placeholders found are then safely escaped
mut r := regex.regex_opt(r'$([a-zA-Z_][a-zA-Z0-9_]*)') or {
tm.stop_cache_handler()
eprintln('${dtm.message_signature_error} with regular expression for identifying placeholders in the HTML template in clean_parsed_html() function. Please check the syntax of the regex pattern.')
eprintln('${dtm.message_signature_error} with regular expression for identifying placeholders in the HTML template in clean_parsed_html() function. Please check the syntax of the regex pattern : ${err.msg()}')
return dtm.internat_server_error
}
indices := r.find_all(html)
Expand Down

0 comments on commit 083397c

Please sign in to comment.