Skip to content

Conversation

@mgautierfr
Copy link
Contributor

Supersedes #55

This is a old commit I had in my repository. It seems a bit better than #55 that does the same thing.

@mgautierfr mgautierfr requested a review from rgaudin June 29, 2020 13:28
mgautierfr and others added 2 commits June 29, 2020 15:32
- Catch all python exception, not only the getattr.
- Use a string instead of a int as error "marker" to provide more
  information to the user.
- Pass the full traceback in the string. This way the user can have
  information of where the exception was raised.

`get_article_method_from_object` is removed as it was mainly calling
`getattr` and handle error. As we also need to handle error for the method
call, the handle in the specific function is not needed. And we don't need a
function that just call another one.
As the libzim lacks a `cancel()` method to properly stop a ZIM file creation process
without calling `finalize()` (which always creates the ZIM file), users need to cheat
the creator to not call finalize(), even upon exit (as `Creator`'s destructor do call `finalize()`)

Test instanciates a different python VM as the libzim_reader tests (manual garbage collection)
leads to a segfault.
@mgautierfr mgautierfr force-pushed the better_error_handling branch from e221bac to ea307f5 Compare June 29, 2020 13:33
Copy link
Member

@rgaudin rgaudin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great!

@mgautierfr mgautierfr merged commit d04494c into master Jun 29, 2020
@mgautierfr mgautierfr deleted the better_error_handling branch June 29, 2020 14:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants