Update error message tips

This commit is contained in:
Spxg
2025-05-25 15:42:02 +08:00
parent 4ca69466ad
commit 3e414e0c86
3 changed files with 9 additions and 6 deletions

View File

@@ -32,18 +32,21 @@ pub fn Status() -> impl IntoView {
"This shouldn't happen, please create an issue on github."
}
SQLitendError::OpenDb(_) | SQLitendError::Step(_) => {
"If database disk image is malformed, enable the discard context option and run it once."
"If database disk image is malformed, change the context option and run it once."
}
SQLitendError::Prepare(_) => "Check if the syntax is correct.",
SQLitendError::UnsupportColumnType(_) => {
"An unsupported type was encountered, please create an issue on github."
}
},
WorkerError::NotFound | WorkerError::Unexpected => {
WorkerError::NotOpened => {
"This is most likely to happen only on OPFS VFS, switch VFS and try again."
}
WorkerError::Unexpected => {
"This shouldn't happen, please create an issue on github."
}
WorkerError::InvaildState => {
"SQLite is in an abnormal state when executing sql, enable the discard context option and run it once."
"SQLite is in an abnormal state when executing sql, change the context option and run it once."
}
WorkerError::LoadDb(_) => "Check whether the imported DB is a SQLite3 file.",
WorkerError::DownloadDb(_) => "It may be caused by OOM.",

View File

@@ -77,8 +77,8 @@ impl SQLightError {
pub enum WorkerError {
#[error(transparent)]
SQLite(#[from] SQLitendError),
#[error("Not found database")]
NotFound,
#[error("DB is not opened")]
NotOpened,
#[error("Execute sqlite with invaild state")]
InvaildState,
#[error("OPFS already opened")]

View File

@@ -49,7 +49,7 @@ async fn with_worker<F, T>(mut f: F) -> Result<T>
where
F: FnMut(&mut SQLiteWorker) -> Result<T>,
{
f(DB.lock().await.as_mut().ok_or(WorkerError::NotFound)?)
f(DB.lock().await.as_mut().ok_or(WorkerError::NotOpened)?)
}
async fn init_opfs_util() -> Result<&'static OpfsSAHPoolUtil> {