aerkalov / ebooklib

Python E-book library for handling books in EPUB2/EPUB3 format -
https://ebooklib.readthedocs.io/
GNU Affero General Public License v3.0
1.5k stars 233 forks source link

write_epub swallows IOError #266

Open BenjaminHamon opened 2 years ago

BenjaminHamon commented 2 years ago

The write_epub function, which is visibly the main function to create a EPUB file and which is used in the main example for the package, swallows IOError.

https://github.com/aerkalov/ebooklib/blob/d4febc04468ed682bf300ec927411b2faadc17ab/ebooklib/epub.py#L1745-L1748

This seems dangerous, or at the very least strange, since the caller for such a function would expect to be notified of such an error, and generally swallowing exceptions is a bad practice. Right now the function fails silently.

aerkalov commented 1 year ago

Very good point. This is just wrong. When it comes to exceptions probably the whole system when it comes to read/write should be overlooked and more custom exceptions should be introduced.