Skip to content

Commit

Permalink
restore exception logging
Browse files Browse the repository at this point in the history
  • Loading branch information
dhellmann committed Jun 6, 2024
1 parent 1be64cb commit c597947
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ build = [
Repository = "https://github.com/python-wheel-build/fromager"

[project.scripts]
fromager = "fromager.__main__:main"
fromager = "fromager.__main__:invoke_main"

[project.entry-points."fromager.project_overrides"]
# This test plugin should stay in the package.
Expand Down
13 changes: 12 additions & 1 deletion src/fromager/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,5 +74,16 @@ def main(ctx, verbose, log_file,
for cmd in commands.commands:
main.add_command(cmd)


def invoke_main():
# Wrapper for the click main command that ensures any exceptions
# are logged so that build pipeline outputs include the traceback.
try:
main(auto_envvar_prefix='FROMAGER')
except Exception as err:
logger.exception(err)
raise


if __name__ == '__main__':
main(auto_envvar_prefix='FROMAGER')
invoke_main()

0 comments on commit c597947

Please sign in to comment.