mirror of
https://github.com/TECHNOFAB11/bumpver.git
synced 2025-12-13 15:00:15 +01:00
better error messages and fixups
This commit is contained in:
parent
2f421daf16
commit
f705164e75
7 changed files with 155 additions and 123 deletions
|
|
@ -13,6 +13,7 @@ from . import parse
|
|||
from . import config
|
||||
from . import rewrite
|
||||
from . import version
|
||||
from . import regexfmt
|
||||
from . import v1version
|
||||
from .patterns import Pattern
|
||||
|
||||
|
|
@ -39,7 +40,13 @@ def rewrite_lines(
|
|||
if non_matched_patterns:
|
||||
for nmp in non_matched_patterns:
|
||||
logger.error(f"No match for pattern '{nmp.raw_pattern}'")
|
||||
logger.error(f"Pattern compiles to regex '{nmp.regexp.pattern}'")
|
||||
msg = (
|
||||
"\n# "
|
||||
+ regexfmt.regex101_url(nmp.regexp.pattern)
|
||||
+ "\nregex = "
|
||||
+ regexfmt.pyexpr_regex(nmp.regexp.pattern)
|
||||
)
|
||||
logger.error(msg)
|
||||
raise rewrite.NoPatternMatch("Invalid pattern(s)")
|
||||
else:
|
||||
return new_lines
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue