Skip to content

Commit

Permalink
Ensure log path is always printed, even on error
Browse files Browse the repository at this point in the history
  • Loading branch information
jwodder committed Dec 15, 2020
1 parent 6e1503a commit 0729276
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
5 changes: 4 additions & 1 deletion dandi/cli/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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

Expand Down
6 changes: 0 additions & 6 deletions dandi/cli/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
#
Expand Down

0 comments on commit 0729276

Please sign in to comment.