Allow equality comparison of Error

This commit is contained in:
2026-07-19 09:55:08 -04:00
parent 3816f3ef28
commit a0931eb420

View File

@@ -6,7 +6,7 @@ use serde::{Deserialize, Serialize};
/// A location in the source code /// A location in the source code
/// A thin wrapper over `std::panic::Location`, which isn't `Serialize` or `Deserialize` /// A thin wrapper over `std::panic::Location`, which isn't `Serialize` or `Deserialize`
#[derive(Debug, Clone, Serialize, Deserialize)] #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct ErrorLocation { pub struct ErrorLocation {
file: String, file: String,
line: u32, line: u32,
@@ -59,7 +59,7 @@ fn rand_modal_id() -> String {
format!("err-modal-{random_str}") format!("err-modal-{random_str}")
} }
#[derive(Debug, Clone, Deserialize, Serialize, thiserror::Error)] #[derive(Debug, Clone, PartialEq, Deserialize, Serialize, thiserror::Error)]
pub struct Error { pub struct Error {
#[source] #[source]
/// The error type and data /// The error type and data
@@ -307,7 +307,7 @@ impl<T, E: Into<Error>> Contextualize<Result<T>> for E {
} }
} }
#[derive(Debug, Clone, thiserror::Error, Deserialize, Serialize)] #[derive(Debug, Clone, PartialEq, thiserror::Error, Deserialize, Serialize)]
pub enum ErrorType { pub enum ErrorType {
#[error("Authentication error: {0}")] #[error("Authentication error: {0}")]
Auth(AuthError), Auth(AuthError),
@@ -365,7 +365,7 @@ impl From<fred::error::Error> for Error {
} }
} }
#[derive(Debug, Clone, thiserror::Error, Deserialize, Serialize)] #[derive(Debug, Clone, PartialEq, thiserror::Error, Deserialize, Serialize)]
pub enum AuthError { pub enum AuthError {
#[error("Invalid credentials")] #[error("Invalid credentials")]
InvalidCredentials, InvalidCredentials,