style(downloads): Made all errors type-based

Signed-off-by: quexeky <git@quexeky.dev>
This commit is contained in:
quexeky
2024-11-18 13:21:20 +11:00
parent bd3deacf38
commit ec2f4148e8
9 changed files with 89 additions and 100 deletions

View File

@ -93,9 +93,7 @@ fn recieve_handshake_logic(app: &AppHandle, path: String) -> Result<(), RemoteAc
let path_chunks: Vec<&str> = path.split("/").collect();
if path_chunks.len() != 3 {
app.emit("auth/failed", ()).unwrap();
return Err(RemoteAccessError::GenericErrror(
"Invalid number of handshake chunks".to_string(),
));
return Err(RemoteAccessError::InvalidResponse);
}
let base_url = {
@ -165,9 +163,7 @@ async fn auth_initiate_wrapper() -> Result<(), RemoteAccessError> {
let response = client.post(endpoint.to_string()).json(&body).send().await?;
if response.status() != 200 {
return Err("Failed to create redirect URL. Please try again later."
.to_string()
.into());
return Err(RemoteAccessError::InvalidRedirect);
}
let redir_url = response.text().await?;