Small friends fixes (#4270)

* Ensure that fetch errors are properly propagated

* Handle user not found errors better in add_friend

* Cargo fmt

* Introduce new LabrinthError returnable by fetch_advanced

* Allow enter key to send a friend request
This commit is contained in:
Josiah Glosson
2025-08-29 07:08:26 -07:00
committed by GitHub
parent 8b98087936
commit 8fa01b937d
9 changed files with 149 additions and 135 deletions

View File

@@ -3,8 +3,17 @@ use std::sync::Arc;
use crate::{profile, util};
use data_url::DataUrlError;
use derive_more::Display;
use serde::{Deserialize, Serialize};
use tracing_error::InstrumentError;
#[derive(Serialize, Deserialize, Debug, Display)]
#[display("{description}")]
pub struct LabrinthError {
pub error: String,
pub description: String,
}
#[derive(thiserror::Error, Debug)]
pub enum ErrorKind {
#[error("Filesystem error: {0}")]
@@ -56,6 +65,9 @@ pub enum ErrorKind {
#[error("Error fetching URL: {0}")]
FetchError(#[from] reqwest::Error),
#[error("{0}")]
LabrinthError(LabrinthError),
#[error("Websocket error: {0}")]
WSError(#[from] async_tungstenite::tungstenite::Error),