Uahh/ToastFish · error
$"重置 出错!
Error message
$"重置{TableName}出错!" What it means
In the reset-word-count handler of MainWindow (View/ToastFish.xaml.cs:654), the code calls Se.ResetTableCount() inside a try block; if any exception is thrown while resetting the word-count table for TableName (typically an SQLite/DataAccess failure), the catch swallows the real exception and surfaces only the generic message "重置{TableName}出错!" via pushWords.PushMessage. The user therefore sees a reset failure notification without the underlying DB error, making diagnosis dependent on the swallowed exception.
Solutions
- Log the actual exception in the catch (ex.Message / ex.ToString()) instead of discarding it, so the real cause is visible.
- Check that the SQLite database file exists and is not locked by another process (close DB browsers, kill duplicate ToastFish instances), then retry the reset.
- Ensure the count table for TableName exists before reset (run the app's initialization/book-update path, e.g. Se.UpdateTableCount(), once successfully).
- Verify file permissions on the database directory if the app lives under a protected or synced folder.
- As a last resort, move/rename the corrupt database file and let ToastFish recreate it, then re-import the book.
Example fix
// before
catch {
pushWords.PushMessage($"重置{TableName}出错!");
}
// after
catch (Exception ex) {
pushWords.PushMessage($"重置{TableName}出错!:{ex.Message}");
System.Diagnostics.Debug.WriteLine(ex);
} Defensive patterns
Strategy: try-catch
Validate before calling
// before calling the reset API
db.Open();
using (var cmd = new SQLiteCommand("SELECT count(*) FROM sqlite_master WHERE type='table' AND name=@t", db))
{
cmd.Parameters.AddWithValue("@t", TableName);
if (Convert.ToInt64(cmd.ExecuteScalar()) == 0)
throw new InvalidOperationException($"count table for {TableName} does not exist");
} Try / catch
try
{
Se.ResetTableCount();
pushWords.PushMessage($"重置{TableName}完成!");
}
catch (SQLiteException ex) when (ex.ResultCode == SQLiteErrorCode.Busy || ex.ResultCode == SQLiteErrorCode.Locked)
{
pushWords.PushMessage($"重置{TableName}出错!数据库被占用,请关闭其他程序后重试。");
}
catch (Exception ex)
{
pushWords.PushMessage($"重置{TableName}出错!:{ex.Message}");
} Prevention
- Always log the caught exception; never swallow it silently.
- Close any external SQLite connections/DB browsers before resetting.
- Ensure book initialization (table creation) completes before offering the reset action.
- Keep the database in a user-writable, non-synced folder.
- Use a single instance guard so two processes don't fight over the SQLite file lock.
When it happens
Trigger: Clicking the tray reset menu item when Se.ResetTableCount() throws: the SQLite database file is locked/missing/corrupt, the word-count table doesn't exist for TableName, the DB write fails due to permissions, or the SELECT/UPDATE fails because the table was never initialized for the current word book.
Common situations: Resetting progress for a newly selected book whose count table hasn't been created yet; another ToastFish instance or an external tool (e.g. DB browser) holds the SQLite file lock; OneDrive/roaming-profile path where the .db file is unavailable; corrupted database after an unclean shutdown.
Related errors
- ex.Message
- ex.Message, "Excel read error"
- 导入失败,Excel格式不正确或Excel文件损坏
- 程序已经在运行了,不能运行两次。\n如果右下角软件已经退出,请在任务管理器中结束ToastFish任务。
- 卡题出错!
AI-assisted analysis of Uahh/ToastFish@2508784a66 (2026-09-15).
Data as JSON: /api/errors/9f5176ddbf04fd6d.
Report an issue: GitHub.
Appendix: source
Thrown at View/ToastFish.xaml.cs:654
bool isok= TablelDictionary.TryGetValue(Select.TABLE_NAME, out TableName);
if (!isok) {
return;
}
DialogResult result = System.Windows.Forms.MessageBox.Show(
$"是否要重置“{TableName}”的学习进度?", $"进度重置:{Select.TABLE_NAME}",
MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if (result==System.Windows.Forms.DialogResult.Yes)
{
try {
Se.ResetTableCount();
pushWords.PushMessage($"重置{TableName}完成!");
//System.Windows.Forms.MessageBox.Show($"重置{TableName}完成!");
}
catch {
pushWords.PushMessage($"重置{TableName}出错!");
// System.Windows.Forms.MessageBox.Show($"重置{TableName}出错!");
}
}
//this.Se.
}
private void ShortCuts_Click(object sender, EventArgs e)
{
System.Windows.Forms.MessageBox.Show("ALT+Q :开始内置单词学习\nALT+~ :英语单词发音\nALT+1到4:对应点击按钮1到4", "版本号:2.3.3");
}
private void AutoPlay_Click(object sender, EventArgs e)
{
//sender as ToolStripMenuItem).Checked = !(sender as ToolStripMenuItem).Checked;
if (Select.AUTO_PLAY == 0)
{
Select.AUTO_PLAY = 1;
(sender as ToolStripMenuItem).Checked = true;
} View on GitHub (pinned to 2508784a66)