mirror of
https://github.com/LHY0125/PathEditor.git
synced 2026-06-30 18:45:55 +08:00
3a21891f84
- handleBrowse 改用 @tauri-apps/plugin-dialog 原生目录选择 - handleImport 清理临时 DOM 元素(add input.remove()) - config/default.json 实际导入生效(maxHistory、path 长度限制) - app-store.ts 长度检查改用配置值 - 删除 AppShell 中与 store 重复的长度检查 - 新增 ErrorBoundary 组件避免单异常白屏 - StatusBar 加载失败时显示重试按钮 - 取消按钮检查 isModified 未保存提示 - lib.rs 注册 tauri-plugin-dialog - tsconfig 添加 resolveJsonModule - CLAUDE.md 添加 cargo test 运行时说明 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
36 lines
775 B
Rust
36 lines
775 B
Rust
use serde::Serialize;
|
||
|
||
/// 传给前端的统一错误类型(保留供未来使用,当前命令返回 Result<T, String>)
|
||
#[derive(Debug, Serialize)]
|
||
pub struct AppError {
|
||
pub message: String,
|
||
}
|
||
|
||
impl std::fmt::Display for AppError {
|
||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||
write!(f, "{}", self.message)
|
||
}
|
||
}
|
||
|
||
impl From<&str> for AppError {
|
||
fn from(s: &str) -> Self {
|
||
AppError {
|
||
message: s.to_string(),
|
||
}
|
||
}
|
||
}
|
||
|
||
impl From<String> for AppError {
|
||
fn from(s: String) -> Self {
|
||
AppError { message: s }
|
||
}
|
||
}
|
||
|
||
impl From<std::io::Error> for AppError {
|
||
fn from(e: std::io::Error) -> Self {
|
||
AppError {
|
||
message: format!("IO 错误: {}", e),
|
||
}
|
||
}
|
||
}
|