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

don't show trace for --help without FLASK_APP #3604

Closed
wants to merge 2 commits into from

Conversation

obfusk
Copy link

@obfusk obfusk commented May 8, 2020

Fixes #2741.

@obfusk obfusk marked this pull request as draft May 9, 2020 14:25
@obfusk obfusk force-pushed the fix-cli-help-exception branch 4 times, most recently from a844664 to 40c7d2a Compare May 9, 2020 15:30
@obfusk obfusk marked this pull request as ready for review May 9, 2020 15:37
traceback.print_exc()
except NoAppException as e:
# We don't want the help page to break if the app does not exist.
print("Error:", e, file=sys.stderr)

Choose a reason for hiding this comment

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

Isn't it useful to have a full traceback?

Copy link
Member

Choose a reason for hiding this comment

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

In flask --help or flask without args? I'd say no... individual subcommands will still have the traceback AFAIU.

Choose a reason for hiding this comment

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

Oh right – that makes sense (thanks)

@davidism davidism changed the title CLI: no stacktrace for each --help w/o FLASK_APP don't show trace for --help without FLASK_APP Jul 28, 2020
@davidism davidism added the cli label Jul 28, 2020
@davidism davidism added this to the 2.0.0 milestone Jul 28, 2020
@davidism
Copy link
Member

Thanks for working on this. After looking at how the error messages work right now, I've concluded that this isn't the correct fix. The tracebacks were added in #2208. #2209 (comment) suggests hiding the traceback and showing the message only for NoAppException, and showing the traceback for other exceptions. I independently implemented the same thing before I saw that comment, so I'm going to go with that.

@davidism davidism closed this Jul 30, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 14, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Better exception handling when env vars are missing for flask CLI
4 participants