From 1b47eb71e1c5d5d0dda8bc97606f364489300919 Mon Sep 17 00:00:00 2001 From: Geometrically <18202329+Geometrically@users.noreply.github.com> Date: Mon, 22 May 2023 18:11:31 -0700 Subject: [PATCH] Error handling (#121) --- theseus_gui/package.json | 2 +- theseus_gui/src-tauri/src/api/mod.rs | 32 ++++++++--------- theseus_gui/src/App.vue | 34 +++++++++++++++--- theseus_gui/src/assets/icons/folder-open.svg | 4 --- .../src/assets/icons/folder-search.svg | 6 ---- theseus_gui/src/assets/icons/hammer.svg | 1 - theseus_gui/src/assets/icons/index.js | 8 ----- theseus_gui/src/assets/icons/log-in.svg | 1 - theseus_gui/src/assets/icons/play.svg | 4 --- theseus_gui/src/assets/icons/stop-circle.svg | 1 - .../src/assets/icons/terminal-square.svg | 1 - theseus_gui/src/assets/icons/users.svg | 1 - theseus_gui/src/assets/icons/x-circle.svg | 6 ---- .../src/components/ui/AccountsCard.vue | 20 +++++------ .../ui/IncompatibilityWarningModal.vue | 3 +- theseus_gui/src/components/ui/Instance.vue | 27 +++++++------- .../components/ui/InstanceCreationModal.vue | 20 +++++------ .../components/ui/InstanceInstallModal.vue | 14 ++++---- .../src/components/ui/JavaDetectionModal.vue | 9 ++--- .../src/components/ui/JavaSelector.vue | 17 ++++++--- .../src/components/ui/RunningAppBar.vue | 17 +++++---- theseus_gui/src/components/ui/SearchCard.vue | 20 +++++------ theseus_gui/src/helpers/fetch.js | 10 ++++++ theseus_gui/src/helpers/utils.js | 14 ++++---- theseus_gui/src/pages/Browse.vue | 15 ++++---- theseus_gui/src/pages/Index.vue | 15 ++++---- theseus_gui/src/pages/Library.vue | 5 +-- theseus_gui/src/pages/Settings.vue | 6 ++-- theseus_gui/src/pages/instance/Index.vue | 32 +++++++++++------ theseus_gui/src/pages/instance/Logs.vue | 14 +++++--- theseus_gui/src/pages/instance/Mods.vue | 9 ++--- theseus_gui/src/pages/instance/Options.vue | 30 ++++++++-------- theseus_gui/src/pages/project/Index.vue | 35 ++++++++++++------- theseus_gui/src/store/notifications.js | 25 +++++++++++++ theseus_gui/src/store/state.js | 3 +- theseus_gui/yarn.lock | 8 ++--- 36 files changed, 271 insertions(+), 198 deletions(-) delete mode 100644 theseus_gui/src/assets/icons/folder-open.svg delete mode 100644 theseus_gui/src/assets/icons/folder-search.svg delete mode 100644 theseus_gui/src/assets/icons/hammer.svg delete mode 100644 theseus_gui/src/assets/icons/index.js delete mode 100644 theseus_gui/src/assets/icons/log-in.svg delete mode 100644 theseus_gui/src/assets/icons/play.svg delete mode 100644 theseus_gui/src/assets/icons/stop-circle.svg delete mode 100644 theseus_gui/src/assets/icons/terminal-square.svg delete mode 100644 theseus_gui/src/assets/icons/users.svg delete mode 100644 theseus_gui/src/assets/icons/x-circle.svg create mode 100644 theseus_gui/src/helpers/fetch.js create mode 100644 theseus_gui/src/store/notifications.js diff --git a/theseus_gui/package.json b/theseus_gui/package.json index 198fc6b5c..7a70c6d97 100644 --- a/theseus_gui/package.json +++ b/theseus_gui/package.json @@ -15,7 +15,7 @@ "dependencies": { "@tauri-apps/api": "^1.2.0", "ofetch": "^1.0.1", - "omorphia": "^0.4.16", + "omorphia": "^0.4.17", "pinia": "^2.0.33", "vite-svg-loader": "^4.0.0", "vue": "^3.2.45", diff --git a/theseus_gui/src-tauri/src/api/mod.rs b/theseus_gui/src-tauri/src/api/mod.rs index 3905de054..6cd337f68 100644 --- a/theseus_gui/src-tauri/src/api/mod.rs +++ b/theseus_gui/src-tauri/src/api/mod.rs @@ -13,15 +13,15 @@ pub mod profile_create; pub mod settings; pub mod tags; -pub type Result = std::result::Result; +pub type Result = std::result::Result; -// Main returnable Theseus GUI error -// Needs to be Serializable to be returned to the JavaScript side -#[derive(Error, Debug, Serialize)] -pub enum TheseusGuiError { - #[error(transparent)] - Serializable(TheseusSerializableError), -} +// // Main returnable Theseus GUI error +// // Needs to be Serializable to be returned to the JavaScript side +// #[derive(Error, Debug, Serialize)] +// pub enum TheseusGuiError { +// #[error(transparent)] +// Serializable(), +// } // Serializable error intermediary, so TheseusGuiError can be Serializable (eg: so that we can return theseus::Errors in Tauri directly) #[derive(Error, Debug)] @@ -34,14 +34,14 @@ pub enum TheseusSerializableError { } // Generic implementation of From for ErrorTypeA -impl From for TheseusGuiError -where - TheseusSerializableError: From, -{ - fn from(error: T) -> Self { - TheseusGuiError::Serializable(TheseusSerializableError::from(error)) - } -} +// impl From for TheseusGuiError +// where +// TheseusSerializableError: From, +// { +// fn from(error: T) -> Self { +// TheseusGuiError::Serializable(TheseusSerializableError::from(error)) +// } +// } // Lists active progress bars // Create a new HashMap with the same keys diff --git a/theseus_gui/src/App.vue b/theseus_gui/src/App.vue index fc9109196..7f590efaf 100644 --- a/theseus_gui/src/App.vue +++ b/theseus_gui/src/App.vue @@ -1,8 +1,16 @@