split py into modules
This commit is contained in:
11
lektor_groupby/util.py
Normal file
11
lektor_groupby/util.py
Normal file
@@ -0,0 +1,11 @@
|
||||
from lektor.reporter import reporter, style
|
||||
|
||||
|
||||
def report_config_error(key: str, field: str, val: str, e: Exception) -> None:
|
||||
''' Send error message to Lektor reporter. Indicate which field is bad. '''
|
||||
msg = '[ERROR] invalid config for [{}.{}] = "{}", Error: {}'.format(
|
||||
key, field, val, repr(e))
|
||||
try:
|
||||
reporter._write_line(style(msg, fg='red'))
|
||||
except Exception:
|
||||
print(msg) # fallback in case Lektor API changes
|
||||
Reference in New Issue
Block a user