From 1c59315e9d14a4160b6e744ded08312aa8c70d11 Mon Sep 17 00:00:00 2001 From: John Estabrook Date: Wed, 19 Jun 2024 20:31:06 -0500 Subject: migration: T6447: add traceback on error --- python/vyos/compose_config.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'python/vyos/compose_config.py') diff --git a/python/vyos/compose_config.py b/python/vyos/compose_config.py index efa28babe..208c89dad 100644 --- a/python/vyos/compose_config.py +++ b/python/vyos/compose_config.py @@ -17,6 +17,7 @@ config. """ +import traceback from pathlib import Path from typing import TypeAlias, Union, Callable @@ -70,7 +71,9 @@ class ComposeConfig: try: self.apply_func(func) except ComposeConfigError as e: - raise ComposeConfigError(f'Error in {func_file}: {e}') from e + msg = str(e) + tb = f'{traceback.format_exc()}' + raise ComposeConfigError(f'Error in {func_file}: {msg}\n{tb}') from e def to_string(self, with_version=False) -> str: """Return the rendered config tree. -- cgit v1.2.3