diff --git a/dandi/cli/base.py b/dandi/cli/base.py index 820b1ee3f..1004a9034 100644 --- a/dandi/cli/base.py +++ b/dandi/cli/base.py @@ -97,8 +97,9 @@ def map_to_click_exceptions(f): Will be active only if DANDI_DEVEL is not set and --pdb is not given """ + @click.pass_obj @wraps(f) - def wrapper(*args, **kwargs): + def wrapper(obj, *args, **kwargs): import girder_client as gcl from ..girder import get_HttpError_response @@ -122,6 +123,8 @@ def wrapper(*args, **kwargs): if not map_to_click_exceptions._do_map: raise raise click.ClickException(e_str) + finally: + lgr.info("Logs saved in %s", obj.logfile) return wrapper diff --git a/dandi/cli/command.py b/dandi/cli/command.py index d323ca852..68176e83a 100644 --- a/dandi/cli/command.py +++ b/dandi/cli/command.py @@ -128,12 +128,6 @@ def main(ctx, log_level, pdb=False): ) -@main.resultcallback() -@click.pass_obj -def cleanup(obj, *args, **kwargs): - lgr.info("Logs saved in %s", obj.logfile) - - # # Commands in the main group #