mirror of
				https://github.com/yuezk/GlobalProtect-openconnect.git
				synced 2025-05-20 07:26:58 -04:00 
			
		
		
		
	refactor: improve the error message
This commit is contained in:
		| @@ -32,12 +32,15 @@ impl AppStorage<'_> { | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     /// Get a value from the store (.data.json). | ||||
|     /// If the value is encrypted, it will be decrypted. | ||||
|     /// If the value is not found, or if there is an error, `None` is returned. | ||||
|     pub fn get<T: DeserializeOwned + Debug>(&self, hint: KeyHint) -> Option<T> { | ||||
|         let stores = self.app_handle.state::<StoreCollection<Wry>>(); | ||||
|         with_store(self.app_handle.clone(), stores, self.path, |store| { | ||||
|             store | ||||
|                 .get(hint.key) | ||||
|                 .ok_or_else(|| Error::Deserialize("Value not found".into())) | ||||
|                 .ok_or_else(|| Error::Deserialize(format!("Key {} not found in store", hint.key).into())) | ||||
|                 .and_then(|value| { | ||||
|                     if !hint.encrypted { | ||||
|                         return Ok(serde_json::from_value::<T>(value.clone())?); | ||||
|   | ||||
| @@ -66,6 +66,7 @@ export default function PasswordAuth() { | ||||
|               type="submit" | ||||
|               loading={loading} | ||||
|               disabled={loading} | ||||
|               sx={{ flex: 1 }} | ||||
|             > | ||||
|               Login | ||||
|             </LoadingButton> | ||||
|   | ||||
		Reference in New Issue
	
	Block a user