2
0
mirror of https://github.com/frappe/bench.git synced 2024-11-16 01:57:08 +00:00

fix: Show traceback if error occurs during init, get outside bench dir

This commit is contained in:
Gavin D'souza 2021-11-19 11:16:19 +05:30
parent f117959801
commit 806d543fac
2 changed files with 10 additions and 3 deletions

View File

@ -109,8 +109,15 @@ def cli():
logger.warning(f"{command} executed with exit code {return_code}") logger.warning(f"{command} executed with exit code {return_code}")
if isinstance(e, Exception): if isinstance(e, Exception):
if os.environ.get("BENCH_DEVELOPER") or bench_config.get("developer_mode"): if (
click.secho("".join(format_exception(*sys.exc_info()))[:-1]) os.environ.get("BENCH_DEVELOPER")
or bench_config.get("developer_mode")
or (
sys.argv[1] in ("init", "get", "get-app") and not in_bench
)
):
from bench.utils import get_traceback
click.echo(get_traceback())
click.secho(f"ERROR: {e}", fg="red") click.secho(f"ERROR: {e}", fg="red")
return_code = 1 return_code = 1
raise e raise e

View File

@ -50,7 +50,7 @@ def init(path, apps_path, frappe_path, frappe_branch, no_procfile, no_backups, c
time.sleep(1) time.sleep(1)
print(get_traceback()) print(get_traceback())
log(f"There was a problem while creating {path}", level=2) log(f"There was a problem while creating {path}", level=2)
if click.confirm("Do you want to rollback these changes?"): if click.confirm("Do you want to rollback these changes?", abort=True):
print(f'Rolling back Bench "{path}"') print(f'Rolling back Bench "{path}"')
if os.path.exists(path): if os.path.exists(path):
shutil.rmtree(path) shutil.rmtree(path)