Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cli: provide full traceback with --debug #4181

Closed
wants to merge 1 commit into from

Conversation

oliver-sanders
Copy link
Member

We should always display full traceback unless the command is running interactively AND the error is an expected one (i.e. a subclass of CylcError, ParsecError) BUT we are not in --debug mode.

In this one case formatting a nice friendly error message for the user is much nicer.

That was the intention but unfortunately it wasn't quite implemented right so here's a fix and a test to go with it.

Requirements check-list

  • I have read CONTRIBUTING.md and added my name as a Code Contributor.
  • Contains logically grouped changes (else tidy your branch by rebase).
  • Does not contain off-topic changes (use other PRs for other changes).
  • Appropriate tests are included (unit and/or functional).
  • Appropriate change log entry included.
  • No documentation update required.
  • No dependency changes.

@oliver-sanders oliver-sanders added this to the cylc-8.0b1 milestone Apr 20, 2021
@oliver-sanders oliver-sanders self-assigned this Apr 20, 2021
@oliver-sanders oliver-sanders modified the milestones: cylc-8.0b1, cylc-8.0b2 Apr 20, 2021
@oliver-sanders
Copy link
Member Author

(will do the changelog once b1 is out)

Comment on lines +254 to +263
# catch "known" CylcErrors which should have sensible short
# summations of the issue, full traceback not necessary
print(
EXC_EXIT.format(
name=exc.__class__.__name__,
exc=exc
),
file=sys.stderr
)
sys.exit(1)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Note to self, really) Ah, so this is called when commands other than cylc play raise, or if an exception occurs in scheduler_cli before it runs the scheduler - the scheduler has its own error logging logic

Question: Should I update #4180 so that if --debug is used, the scheduler will print out the full traceback for CylcErrors too?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be nice if the scheduler dumped full traceback in --debug mode (can be helpful sometimes).

@oliver-sanders oliver-sanders marked this pull request as draft April 22, 2021 10:12
@oliver-sanders oliver-sanders removed the request for review from wxtim April 22, 2021 10:12
@oliver-sanders oliver-sanders mentioned this pull request May 14, 2021
7 tasks
@oliver-sanders oliver-sanders removed this from the cylc-8.0b2 milestone May 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants