-
-
Notifications
You must be signed in to change notification settings - Fork 53
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
Implement global except hook, refactor current exceptions handling #73
Labels
Milestone
Comments
18 tasks
On verbose excepthook will preformat issues template for convenience. Otherwise, it'll just print traceback with msg. Final result: $ fastapi-mvc run
[WARNING] Activated virtual env detected.
[ERROR] Unhandled exception occurred during RunTime.
Traceback (most recent call last):
File "/home/rszamszur/repos/gh/rszamszur/fastapi-mvc/.venv/bin/fastapi-mvc", line 5, in <module>
cli()
File "/home/rszamszur/repos/gh/rszamszur/fastapi-mvc/.venv/lib/python3.9/site-packages/click/core.py", line 829, in __call__
return self.main(*args, **kwargs)
File "/home/rszamszur/repos/gh/rszamszur/fastapi-mvc/.venv/lib/python3.9/site-packages/click/core.py", line 782, in main
rv = self.invoke(ctx)
File "/home/rszamszur/repos/gh/rszamszur/fastapi-mvc/.venv/lib/python3.9/site-packages/click/core.py", line 1259, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/home/rszamszur/repos/gh/rszamszur/fastapi-mvc/.venv/lib/python3.9/site-packages/click/core.py", line 1066, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/home/rszamszur/repos/gh/rszamszur/fastapi-mvc/.venv/lib/python3.9/site-packages/click/core.py", line 610, in invoke
return callback(*args, **kwargs)
File "/home/rszamszur/repos/gh/rszamszur/fastapi-mvc/fastapi_mvc/cli/run.py", line 37, in run
borg.require_installed()
File "/home/rszamszur/repos/gh/rszamszur/fastapi-mvc/fastapi_mvc/borg.py", line 130, in require_installed
ShellUtils.run_shell(
File "/home/rszamszur/repos/gh/rszamszur/fastapi-mvc/fastapi_mvc/utils/shell.py", line 91, in run_shell
process = subprocess.run(
File "/nix/store/y3inmdhijqkb4qj36yphj4cbllljhqzz-python3-3.9.6/lib/python3.9/subprocess.py", line 505, in run
with Popen(*popenargs, **kwargs) as process:
File "/nix/store/y3inmdhijqkb4qj36yphj4cbllljhqzz-python3-3.9.6/lib/python3.9/subprocess.py", line 951, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "/nix/store/y3inmdhijqkb4qj36yphj4cbllljhqzz-python3-3.9.6/lib/python3.9/subprocess.py", line 1821, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'poetry'
[INFO] Help improve fastapi-mvc :)
It does not have to be a defect immediately. But if you think this should not
happen or it would make a nice feature, feel free to create an issue:
https://github.com/rszamszur/fastapi-mvc/issues/new
Hint: Running with `--verbose` will preformat markdown issues template for you:
fastapi-mvc --verbose run
(.venv)
$ fastapi-mvc --verbose run
[2022-04-22 20:50:29 +0200] [Borg:48] [DEBUG] Initialize first Borg class object instance.
[2022-04-22 20:50:29 +0200] [Invoker:23] [DEBUG] Initialize Invoker class object instance.
[2022-04-22 20:50:29 +0200] [IniParser:29] [DEBUG] Initialize fastapi-mvc.ini parser.
[2022-04-22 20:50:29 +0200] [IniParser:37] [DEBUG] Begin parsing: /tmp/test-app/fastapi-mvc.ini
[2022-04-22 20:50:29 +0200] [Borg:121] [DEBUG] Verifying if fastapi-mvc project is installed.
[2022-04-22 20:50:29 +0200] [fastapi_mvc.utils.shell:75] [DEBUG] Run shell command: ['poetry', 'run', 'test-app', '--help'] under path: /tmp/test-app
[2022-04-22 20:50:29 +0200] [fastapi_mvc.utils.shell:83] [WARNING] Activated virtual env detected.
[2022-04-22 20:50:29 +0200] [GlobalExceptHook:73] [ERROR] Unhandled exception occurred during RunTime.
Traceback (most recent call last):
File "/home/rszamszur/repos/gh/rszamszur/fastapi-mvc/.venv/bin/fastapi-mvc", line 5, in <module>
cli()
File "/home/rszamszur/repos/gh/rszamszur/fastapi-mvc/.venv/lib/python3.9/site-packages/click/core.py", line 829, in __call__
return self.main(*args, **kwargs)
File "/home/rszamszur/repos/gh/rszamszur/fastapi-mvc/.venv/lib/python3.9/site-packages/click/core.py", line 782, in main
rv = self.invoke(ctx)
File "/home/rszamszur/repos/gh/rszamszur/fastapi-mvc/.venv/lib/python3.9/site-packages/click/core.py", line 1259, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/home/rszamszur/repos/gh/rszamszur/fastapi-mvc/.venv/lib/python3.9/site-packages/click/core.py", line 1066, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/home/rszamszur/repos/gh/rszamszur/fastapi-mvc/.venv/lib/python3.9/site-packages/click/core.py", line 610, in invoke
return callback(*args, **kwargs)
File "/home/rszamszur/repos/gh/rszamszur/fastapi-mvc/fastapi_mvc/cli/run.py", line 37, in run
borg.require_installed()
File "/home/rszamszur/repos/gh/rszamszur/fastapi-mvc/fastapi_mvc/borg.py", line 130, in require_installed
ShellUtils.run_shell(
File "/home/rszamszur/repos/gh/rszamszur/fastapi-mvc/fastapi_mvc/utils/shell.py", line 91, in run_shell
process = subprocess.run(
File "/nix/store/y3inmdhijqkb4qj36yphj4cbllljhqzz-python3-3.9.6/lib/python3.9/subprocess.py", line 505, in run
with Popen(*popenargs, **kwargs) as process:
File "/nix/store/y3inmdhijqkb4qj36yphj4cbllljhqzz-python3-3.9.6/lib/python3.9/subprocess.py", line 951, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "/nix/store/y3inmdhijqkb4qj36yphj4cbllljhqzz-python3-3.9.6/lib/python3.9/subprocess.py", line 1821, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'poetry'
[2022-04-22 20:50:29 +0200] [GlobalExceptHook:79] [INFO] Help improve fastapi-mvc :)
It does not have to be a defect immediately. But if you think this should not
happen or it would make a nice feature, feel free to create an issue:
https://github.com/rszamszur/fastapi-mvc/issues/new
I've formated copy-paste markdown with details for you to make things easier.
However, add/edit whatever you see fit.
-----------------------------------------------------------------------------
**Describe the bug**
<!-- A clear and concise description of what the bug is. -->
\```shell
Traceback (most recent call last):
File "/home/rszamszur/repos/gh/rszamszur/fastapi-mvc/.venv/bin/fastapi-mvc", line 5, in <module>
cli()
File "/home/rszamszur/repos/gh/rszamszur/fastapi-mvc/.venv/lib/python3.9/site-packages/click/core.py", line 829, in __call__
return self.main(*args, **kwargs)
File "/home/rszamszur/repos/gh/rszamszur/fastapi-mvc/.venv/lib/python3.9/site-packages/click/core.py", line 782, in main
rv = self.invoke(ctx)
File "/home/rszamszur/repos/gh/rszamszur/fastapi-mvc/.venv/lib/python3.9/site-packages/click/core.py", line 1259, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/home/rszamszur/repos/gh/rszamszur/fastapi-mvc/.venv/lib/python3.9/site-packages/click/core.py", line 1066, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/home/rszamszur/repos/gh/rszamszur/fastapi-mvc/.venv/lib/python3.9/site-packages/click/core.py", line 610, in invoke
return callback(*args, **kwargs)
File "/home/rszamszur/repos/gh/rszamszur/fastapi-mvc/fastapi_mvc/cli/run.py", line 37, in run
borg.require_installed()
File "/home/rszamszur/repos/gh/rszamszur/fastapi-mvc/fastapi_mvc/borg.py", line 130, in require_installed
ShellUtils.run_shell(
File "/home/rszamszur/repos/gh/rszamszur/fastapi-mvc/fastapi_mvc/utils/shell.py", line 91, in run_shell
process = subprocess.run(
File "/nix/store/y3inmdhijqkb4qj36yphj4cbllljhqzz-python3-3.9.6/lib/python3.9/subprocess.py", line 505, in run
with Popen(*popenargs, **kwargs) as process:
File "/nix/store/y3inmdhijqkb4qj36yphj4cbllljhqzz-python3-3.9.6/lib/python3.9/subprocess.py", line 951, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "/nix/store/y3inmdhijqkb4qj36yphj4cbllljhqzz-python3-3.9.6/lib/python3.9/subprocess.py", line 1821, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'poetry'
\```
**Expected behavior**
<!-- A clear and concise description of what you expected to happen. -->
**To Reproduce**
<!-- Steps to reproduce the behavior. -->
\```shell
fastapi-mvc --verbose run
\```
**Environment**
* Python version: `3.9.6`
* Operating System: `Linux-5.10.106-x86_64-with-glibc2.33`
* fastapi-mvc version: `0.10.0`
**Additional context**
<!-- Add any other context about the problem here. -->
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Feature Request
Implement a global except hook for unhandled exceptions that will log exception + debug info to make issuing defects easier.
Something like that:
This feature might require some refactoring in project exceptions.
The text was updated successfully, but these errors were encountered: