Skip to content

Commit

Permalink
Handle git errors as raw message
Browse files Browse the repository at this point in the history
  • Loading branch information
Dramelac committed Aug 24, 2024
1 parent f66bffb commit 4538f5f
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion exegol/manager/ExegolController.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import logging

try:
import docker
import requests
Expand Down Expand Up @@ -69,8 +71,16 @@ def main():
logger.info("Exiting")
except git.exc.GitCommandError as git_error:
print_exception_banner()
# Printing git stderr as raw to avoid any Rich parsing error
logger.debug("Full git output:")
logger.raw(git_error, level=logging.DEBUG)
logger.empty_line()
error = git_error.stderr.strip().split(": ")[-1].strip("'")
logger.critical(f"A critical error occurred while running this git command: {' '.join(git_error.command)} => {error}")
logger.error("Git error received:")
# Printing git error as raw to avoid any Rich parsing error
logger.raw(error, level=logging.ERROR)
logger.empty_line()
logger.critical(f"A critical error occurred while running this git command: {' '.join(git_error.command)}")
except Exception:
print_exception_banner()
console.print_exception(show_locals=True, suppress=[docker, requests, git])
Expand Down

0 comments on commit 4538f5f

Please sign in to comment.