Skip to content

All errors related to a specific stack should include the stack name in the error message. #1306

@dboitnot

Description

@dboitnot

All errors related to a specific stack should include the stack name in the error message.

Because Sceptre may be evaluating several stack configurations at once, an error may be difficult to troubleshoot if it's coming from a stack other than the one being launched/updated/whatever. This is a generalization of #1267. Rather than adding the stack path to messages as they're raised, recommend trapping stack errors and re-throwing them with the stack path.

This will let us avoid updating all the raise sites as well as improving errors thrown outside Sceptre code.

Expected behaviour

Stack trace should include the path of the failing stack configuration.

Actual behaviour

Traceback (most recent call last):
  File "/usr/local/bin/sceptre", line 8, in <module>
    sys.exit(cli())
  File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.9/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/click/decorators.py", line 26, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/sceptre/cli/helpers.py", line 43, in decorated
    return func(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/sceptre/cli/delete.py", line 41, in delete_command
    plan = SceptrePlan(context)
  File "/usr/local/lib/python3.9/site-packages/sceptre/plan/plan.py", line 48, in __init__
    all_stacks, command_stacks = self.config_reader.construct_stacks()
  File "/usr/local/lib/python3.9/site-packages/sceptre/config/reader.py", line 252, in construct_stacks
    stack = self._construct_stack(rel_path, stack_group_config)
  File "/usr/local/lib/python3.9/site-packages/sceptre/config/reader.py", line 575, in _construct_stack
    stack = Stack(
  File "/usr/local/lib/python3.9/site-packages/sceptre/stack.py", line 175, in __init__
    raise InvalidConfigFileError(
sceptre.exceptions.InvalidConfigFileError: Neither 'template_path' nor 'template' is set

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions