Pridat explicitni vyjimku na spatne zformatovane yaml soubory
Closed this issue · 1 comments
befeleme commented
Tento error se stane, pokud yaml s kurzy je spatne zformatovan.
Bylo by lepsi v takovem pripade vyhodit vyjimku, ktere kazdy porozumi.
[2023-09-01 06:40:55,457] ERROR in app: Exception on / [GET]
Traceback (most recent call last):
File "/opt/hostedtoolcache/Python/3.10.12/x64/lib/python3.10/site-packages/flask/app.py", line 2190, in wsgi_app
Generating HTML...
response = self.full_dispatch_request()
File "/opt/hostedtoolcache/Python/3.10.12/x64/lib/python3.10/site-packages/flask/app.py", line 1486, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/opt/hostedtoolcache/Python/3.10.12/x64/lib/python3.10/site-packages/flask/app.py", line 1484, in full_dispatch_request
rv = self.dispatch_request()
File "/opt/hostedtoolcache/Python/3.10.12/x64/lib/python3.10/site-packages/flask/app.py", line 1469, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
File "/home/runner/work/pyladies.cz/pyladies.cz/pyladies_cz.py", line 51, in index
return render_template('index.html', news=news)
File "/opt/hostedtoolcache/Python/3.10.12/x64/lib/python3.10/site-packages/flask/templating.py", line 151, in render_template
return _render(app, template, context)
File "/opt/hostedtoolcache/Python/3.10.12/x64/lib/python3.10/site-packages/flask/templating.py", line 128, in _render
app.update_template_context(context)
File "/opt/hostedtoolcache/Python/3.10.12/x64/lib/python3.10/site-packages/flask/app.py", line 737, in update_template_context
context.update(func())
File "/home/runner/work/pyladies.cz/pyladies.cz/pyladies_cz.py", line 127, in inject_cities
meetups = read_meetups_yaml(f'meetups/{city_name}.yml')
File "/home/runner/work/pyladies.cz/pyladies.cz/pyladies_cz.py", line 196, in read_meetups_yaml
data = read_yaml(filename)
File "/home/runner/work/pyladies.cz/pyladies.cz/pyladies_cz.py", line 185, in read_yaml
return _read_yaml_cached(filename, info.st_size, info.st_mtime)
File "/home/runner/work/pyladies.cz/pyladies.cz/pyladies_cz.py", line 191, in _read_yaml_cached
data = yaml.safe_load(file)
File "/opt/hostedtoolcache/Python/3.10.12/x64/lib/python3.10/site-packages/yaml/__init__.py", line 125, in safe_load
return load(stream, SafeLoader)
File "/opt/hostedtoolcache/Python/3.10.12/x64/lib/python3.10/site-packages/yaml/__init__.py", line 81, in load
return loader.get_single_data()
File "/opt/hostedtoolcache/Python/3.10.12/x64/lib/python3.10/site-packages/yaml/constructor.py", line 49, in get_single_data
node = self.get_single_node()
File "/opt/hostedtoolcache/Python/3.10.12/x64/lib/python3.10/site-packages/yaml/composer.py", line 36, in get_single_node
document = self.compose_document()
File "/opt/hostedtoolcache/Python/3.10.12/x64/lib/python3.10/site-packages/yaml/composer.py", line 55, in compose_document
node = self.compose_node(None, None)
File "/opt/hostedtoolcache/Python/3.10.12/x64/lib/python3.10/site-packages/yaml/composer.py", line 82, in compose_node
node = self.compose_sequence_node(anchor)
File "/opt/hostedtoolcache/Python/3.10.12/x64/lib/python3.10/site-packages/yaml/composer.py", line 111, in compose_sequence_node
node.value.append(self.compose_node(node, index))
File "/opt/hostedtoolcache/Python/3.10.12/x64/lib/python3.10/site-packages/yaml/composer.py", line 84, in compose_node
node = self.compose_mapping_node(anchor)
File "/opt/hostedtoolcache/Python/3.10.12/x64/lib/python3.10/site-packages/yaml/composer.py", line 127, in compose_mapping_node
while not self.check_event(MappingEndEvent):
File "/opt/hostedtoolcache/Python/3.10.12/x64/lib/python3.10/site-packages/yaml/parser.py", line 98, in check_event
self.current_event = self.state()
File "/opt/hostedtoolcache/Python/3.10.12/x64/lib/python3.10/site-packages/yaml/parser.py", line 438, in parse_block_mapping_key
raise ParserError("while parsing a block mapping", self.marks[-1],
yaml.parser.ParserError: while parsing a block mapping
in "meetups/brno.yml", line 473, column 3
expected <block end>, but found '-'
in "meetups/brno.yml", line 481, column 3
Traceback (most recent call last):
File "/home/runner/work/pyladies.cz/pyladies.cz/pyladies_cz.py", line 329, in <module>
cli(app, freezer=freezer, base_url='http://pyladies.cz/')
File "/opt/hostedtoolcache/Python/3.10.12/x64/lib/python3.10/site-packages/elsa/_cli.py", line 174, in cli
return command()
File "/opt/hostedtoolcache/Python/3.10.12/x64/lib/python3.10/site-packages/click/core.py", line 1157, in __call__
return self.main(*args, **kwargs)
File "/opt/hostedtoolcache/Python/3.10.12/x64/lib/python3.10/site-packages/click/core.py", line 1078, in main
rv = self.invoke(ctx)
File "/opt/hostedtoolcache/Python/3.10.12/x64/lib/python3.10/site-packages/click/core.py", line 1688, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/opt/hostedtoolcache/Python/3.10.12/x64/lib/python3.10/site-packages/click/core.py", line 1434, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/opt/hostedtoolcache/Python/3.10.12/x64/lib/python3.10/site-packages/click/core.py", line 783, in invoke
return __callback(*args, **kwargs)
File "/opt/hostedtoolcache/Python/3.10.12/x64/lib/python3.10/site-packages/elsa/_cli.py", line 125, in freeze
freeze_app(app, freezer, path, base_url, verbose=verbose)
File "/opt/hostedtoolcache/Python/3.10.12/x64/lib/python3.10/site-packages/elsa/_cli.py", line 56, in freeze_app
for page in freezer.freeze_yield():
File "/opt/hostedtoolcache/Python/3.10.12/x64/lib/python3.10/site-packages/flask_frozen/__init__.py", line 189, in freeze_yield
new_filename = self._build_one(url, last_modified)
File "/opt/hostedtoolcache/Python/3.10.12/x64/lib/python3.10/site-packages/flask_frozen/__init__.py", line 337, in _build_one
raise ValueError('Unexpected status %r on URL %s' \
ValueError: Unexpected status '500 INTERNAL SERVER ERROR' on URL /
Error: Process completed with exit code 1.
mcurlej commented
@befeleme z technickych dovodom posielam patch... :)
https://pastebin.com/SE12t8Y0