Fixed: application crashing when hosting the split zim files on server, since we have an issue with split zim files of zim-tools. Due to this issue, there is crash reported on the playStore. Because we have full access to files in the playStore variant since all the files are located in the app-specific directory.

* Improved the log for showing the actual error if there is something goes wrong while adding the book in `Library`.
This commit is contained in:
MohitMaliFtechiz 2024-05-16 17:30:58 +05:30 committed by MohitMaliFtechiz
parent 17dac247c7
commit e48e46b923

View File

@ -23,7 +23,6 @@ import org.kiwix.kiwixmobile.core.utils.files.Log
import org.kiwix.kiwixmobile.core.reader.ZimReaderContainer
import org.kiwix.kiwixmobile.core.utils.files.FileUtils.getDemoFilePathForCustomApp
import org.kiwix.libkiwix.Book
import org.kiwix.libkiwix.JNIKiwixException
import org.kiwix.libkiwix.Library
import org.kiwix.libkiwix.Server
import org.kiwix.libzim.Archive
@ -67,8 +66,13 @@ class KiwixServer @Inject constructor(
update(archive)
}
kiwixLibrary.addBook(book)
} catch (e: JNIKiwixException) {
Log.v(TAG, "Couldn't add book with path:{ $path }")
} catch (ignore: Exception) {
// Catch the other exceptions as well. e.g. while hosting the split zim files.
// we have an issue with split zim files, see #3827
Log.v(
TAG,
"Couldn't add book with path:{ $path }.\n Original Exception = $ignore"
)
}
}
return KiwixServer(kiwixLibrary, Server(kiwixLibrary))