Skip to content
Myr

Merge pull request #4310 from HenryKobin/import-error-verbose

Before adoption: this commit came in with the history the project adopted, so no landing records it.

made ImportError verbose in cli.py

authored by David Lord · committed by GitHub · parents b831e85, e679a85 · Browse files · 2 files+7 added−4 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+7 added−4 removed

  • other:+7 added−4 removed

2 files+7 added−4 removed

modified:src/flask/cli.py+5 added-4 removed
256 unmodified lines
257 __traceback_hide__ = True # noqa: F841258259 try:260 __import__(module_name)261 except ImportError as e:261 except ImportError:262 # Reraise the ImportError if it occurred within the imported module.263 # Determine this by checking whether the trace has a depth > 1.264 if sys.exc_info()[2].tb_next:265 raise NoAppException(266 f"While importing {module_name!r}, an ImportError was raised."267 ) from e266 f"While importing {module_name!r}, an ImportError was"267 f" raised:\n\n{traceback.format_exc()}"268 ) from None269 elif raise_if_not_found:269 raise NoAppException(f"Could not import {module_name!r}.") from e270 raise NoAppException(f"Could not import {module_name!r}.") from None271 else:272 return273274 module = sys.modules[module_name]
725 unmodified lines
modified:CHANGES.rst+2 added
8 unmodified lines
9 removed in Werkzeug 2.1. It is now also deprecated in Flask, to be10 removed in Flask 2.1, while remaining compatible with both in11 2.0.x. Use ``response.request.environ`` instead. :pr:`4341`12- Fix type annotation for ``errorhandler`` decorator. :issue:`4295`13- Revert a change to the CLI that caused it to hide ``ImportError``14 tracebacks when importing the application. :issue:`4307`151617Version 2.0.218-------------
1180 unmodified lines