Minor clean-up#1112
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1112 +/- ##
==========================================
+ Coverage 95.98% 96.11% +0.13%
==========================================
Files 64 64
Lines 4107 4096 -11
==========================================
- Hits 3942 3937 -5
+ Misses 165 159 -6
Continue to review full report at Codecov.
|
httpie/core.py
Outdated
| env=env, | ||
| ) | ||
| parsed_args = parser.parse_args(args=args, env=env) | ||
| exit_status = program(args=parsed_args, env=env) |
There was a problem hiding this comment.
parse_args() and program() each have their own try clause intentionally because we handle different types of exceptions for them. For example, we don’t handle base Exceptions from parse_args() as you can see. We also want to keep the try branches minimal and the distinction explicit. To get rid of the duplicate handling of SystemError and KeyboardInterrupt, something like this would be more in line with the intended behavior:
try:
parse_args()
try:
program()
except Timeout:
pass
except TooManyRedirects:
pass
except Exception:
pass
except KeyboardInterrupt:
pass
except SystemExit:
passThere was a problem hiding this comment.
This approach would come with the implicit requirement that the outer except types don’t inherit from Exception. So it would need at least a comment.
There was a problem hiding this comment.
Good catch. I removed the commit as it is not really interesting to change that part for now.
I had a look at tests coverage in the context of #1110 and saw 1-2 things that could be quickly tackled.