Skip to content

Commit

Permalink
Improve error messages regarding track syntax errors (#1908)
Browse files Browse the repository at this point in the history
* Improve error messages regarding track syntax errors

* lint

* Add space, typo, full stop
  • Loading branch information
gareth-ellis authored Jan 29, 2025
1 parent 34f8cf7 commit c5b469d
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions esrally/track/loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -1120,6 +1120,11 @@ def read(self, track_name, track_spec_file, mapping_dir):
f.write(rendered)
self.logger.info("Final rendered track for '%s' has been written to '%s'.", track_spec_file, tmp.name)
track_spec = json.loads(rendered)
except jinja2.exceptions.TemplateSyntaxError as te:
self.logger.exception("Could not load [%s] due to Jinja Syntax Exception.", track_spec_file)
msg = f"Could not load '{track_spec_file}' due to Jinja Syntax Exception. "
msg += f"The track file ({tmp.name}) likely hasn't been written."
raise TrackSyntaxError(msg, te)
except jinja2.exceptions.TemplateNotFound:
self.logger.exception("Could not load [%s]", track_spec_file)
raise exceptions.SystemSetupError(f"Track {track_name} does not exist")
Expand Down Expand Up @@ -1697,6 +1702,8 @@ def parse_task(
default_ramp_up_time_period=None,
completed_by_name=None,
):
if "operation" not in task_spec:
raise TrackSyntaxError("Operation missing from task spec %s in challenge '%s'." % (task_spec, challenge_name))
op_spec = task_spec["operation"]
if isinstance(op_spec, str) and op_spec in ops:
op = ops[op_spec]
Expand Down

0 comments on commit c5b469d

Please sign in to comment.