Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Re-raise exceptions from on_data handler #242

@martinv13

Description

@martinv13

Thank you for this very useful package.

Is your feature request related to a problem? Please describe.

I am using the on_data handler to process decrypted data. When an exception is raised within it, decrypt_file call prints it to the console but does not raise.

In the result returned by decrypt_file I see no clue that this exception was raised.

Describe the solution you'd like

I would prefer that decrypt_file re-raise the exception instead of printing it. Or alternatively that returncode were changed to non-zero. Or another possibility would be simply to warn about this behavior in the doc as I suppose most users would expect decrypt_file to re-raise in the first place (the example shown in the doc says that it does not handle errors but could be further specified).

Describe alternatives you've considered

I could circumvent this issue by handling all exceptions within the callable object passed to on_data, setting a flag when an exception is raised and read this flag afterwards to raise outside decrypt_file call but it does not look very intuitive.

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions