feat(error): add Rust AppError enum and migrate command modules
- AppError enum with 10 variants (Database, Auth, Filesystem, Ipc, NotFound,
Validation, Sidecar, Config, Network, Internal) + serde tag serialization
- From impls for rusqlite::Error, std::io::Error, serde_json::Error
- Migrated 9 command modules from Result<T, String> to Result<T, AppError>
- Frontend receives structured {kind, detail} objects via IPC
This commit is contained in:
parent
365c420901
commit
8b3b0ab720
11 changed files with 319 additions and 81 deletions
|
|
@ -1,23 +1,24 @@
|
|||
use crate::error::AppError;
|
||||
use crate::secrets::SecretsManager;
|
||||
|
||||
#[tauri::command]
|
||||
pub fn secrets_store(key: String, value: String) -> Result<(), String> {
|
||||
SecretsManager::store_secret(&key, &value)
|
||||
pub fn secrets_store(key: String, value: String) -> Result<(), AppError> {
|
||||
SecretsManager::store_secret(&key, &value).map_err(AppError::auth)
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub fn secrets_get(key: String) -> Result<Option<String>, String> {
|
||||
SecretsManager::get_secret(&key)
|
||||
pub fn secrets_get(key: String) -> Result<Option<String>, AppError> {
|
||||
SecretsManager::get_secret(&key).map_err(AppError::auth)
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub fn secrets_delete(key: String) -> Result<(), String> {
|
||||
SecretsManager::delete_secret(&key)
|
||||
pub fn secrets_delete(key: String) -> Result<(), AppError> {
|
||||
SecretsManager::delete_secret(&key).map_err(AppError::auth)
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub fn secrets_list() -> Result<Vec<String>, String> {
|
||||
SecretsManager::list_keys()
|
||||
pub fn secrets_list() -> Result<Vec<String>, AppError> {
|
||||
SecretsManager::list_keys().map_err(AppError::auth)
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue