minimal working on Android with multiple zips' bundle

This commit is contained in:
polv committed 2026-02-28 00:45:51 +07:00
1 parent 7d447f8cf1
commit bd281a3b2e
13 files changed
+165 -115

No files matched your search

+43 -6
View File
@@ -1,26 +1,63 @@
use serde::Serialize;
use thiserror::Error;
use zip::result::ZipError;
#[derive(Debug, Error)]
#[derive(Debug, Error, Serialize)]
#[serde(tag = "kind", content = "message")]
pub enum CJDicError {
#[error("Database error: {0}")]
Database(#[from] rusqlite::Error),
Database(String),
#[error("Serialization error: {0}")]
Serialization(#[from] serde_json::Error),
Serialization(String),
#[error("Anyhow error: {0}")]
AnyhowError(#[from] anyhow::Error),
AnyhowError(String),
#[error("IO error: {0}")]
IOError(#[from] std::io::Error),
IOError(String),
#[error("File name not found")]
FileNameNotFound,
#[error("Zip error: {0}")]
ZipError(#[from] ZipError),
ZipError(String),
#[error("Not found")]
NotFound,
}
impl From<rusqlite::Error> for CJDicError {
fn from(e: rusqlite::Error) -> Self {
log::error!("{e:#}");
CJDicError::Database(e.to_string())
}
}
impl From<serde_json::Error> for CJDicError {
fn from(e: serde_json::Error) -> Self {
log::error!("{e:#}");
CJDicError::Serialization(e.to_string())
}
}
impl From<anyhow::Error> for CJDicError {
fn from(e: anyhow::Error) -> Self {
log::error!("{e:#}");
CJDicError::AnyhowError(e.to_string())
}
}
impl From<std::io::Error> for CJDicError {
fn from(e: std::io::Error) -> Self {
log::error!("{e:#}");
CJDicError::IOError(e.to_string())
}
}
impl From<ZipError> for CJDicError {
fn from(e: ZipError) -> Self {
log::error!("{e:#}");
CJDicError::ZipError(e.to_string())
}
}