Bug: exceptions are swallowed by __exit__
See original GitHub issueDescription
By returning a truthy value from __exit__
, exceptions thrown when using Halo as a context manager are swallowed, and execution continues.
System settings
- Python version: 3.6
- Halo version: 0.0.18
Expected behaviour
✖ Doing the thing ...
Traceback (most recent call last):
File "example.py", line 1337, in example
raise Exception('stuff')
Exception: stuff
Steps to recreate
from halo import Halo
with Halo('Doing the thing ... '):
# No exception seen
raise Exception('stuff')
from halo import Halo
class TransparentHalo(Halo):
def __exit__(self, exc_type, exc_value, traceback):
super().__exit__(exc_type, exc_value, traceback)
# no return
with TransparentHalo('Doing the thing ... '):
raise Exception('stuff')
Issue Analytics
- State:
- Created 5 years ago
- Reactions:2
- Comments:8 (7 by maintainers)
Top Results From Across the Web
Errors after test completion are swallowed #3226 - GitHub
Actual behavior: Tests pass, Mocha exits with code zero. error after test complete ✓ sync ✓ promise ✓ callback 3 passing (16ms).
Read more >Do Not Swallow The Exceptions | Justin James
However this is my least favorite way to not swallow exception as you are still technically swallowing the error but you can at...
Read more >Stopping Twisted from swallowing exceptions - Stack Overflow
Python had a known behavior for uncaught exceptions. They end the process. Any library that changes this behavior is absolutely swallowing the exception....
Read more >507855 – Exceptions being swallowed in DSF - Bugs - Eclipse
I have marked the cases where the exceptions are not being swallowed (18) in the gerrit instead. Rather than rewrite all 100+ locations...
Read more >10 Python Exception Handling Best Practices - CLIMB
Finally, swallowing exceptions is generally considered bad practice because it goes against the principle of “fail early, fail often.” Failing ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
just encountered this myself. if anyone is unclear how to move forward in the meantime, here’s a quick shim:
Aww yiss! That did it! Thank you 😃 The linter fails with this guy I haven’t had time to diagnose, yet, but with an interesting traceback like that, I’m dying to know what the hell it’s doing
It’s been a volcano at work for a hot minute — I’m hoping it’ll die down, and I’ll have Happy Fun Free Time™ again. I dig your motives, and you’ve been hella helpful; I’d love to contribute back.