Closed bashimao closed 6 years ago
This seems like bad default behaviour - this should require a flag (continue on error or somesuch), and the exception information should come through standard syntax, not pulling it out of exc_info().
Could the exception be somehow annotated?
The default behavior right now is "silently crash". I am not sure if that is much better. However, since my code will (depending on the actual problem) print rather cryptic error messages, I agree that it might be worthwhile to wrap it into a command line argument. Do you have any wishes regarding what the command line argument should look like? How about:
--persistent : Ignore errors that occur while extracting files
I think descriptive is best, even if a little longer - I'd go with --continue-on-error
.
The flow I would want to see is catching BaseException
, and if the flag hasn't been given, raising a new exception from the caught one with an appropriate message ("An error occurred while trying to extract a file, the cause will be given below. If you wish to try and extract as much from the archive as possible, please use the --continue-on-error flag.").
I'll see about writing it up myself, but I'm a little busy at the moment - if you want to update the pull request, feel free.
Added as of latest.
...rupted archives!)
Well, it does what it says. Added 3 lines for error checking to avoid the program from crashing if it faces a difficulty.