From db19957de566ed0dd20204d5902670db3e3fea72 Mon Sep 17 00:00:00 2001 From: Zomatree Date: Wed, 22 Oct 2025 21:28:01 +0100 Subject: [PATCH] chore: add temp sentry logging system --- Cargo.lock | 1 + crates/core/database/src/voice/mod.rs | 2 +- crates/core/result/Cargo.toml | 5 ++++- crates/core/result/src/lib.rs | 4 +++- 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 09c213d4..ee03bf55 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6905,6 +6905,7 @@ dependencies = [ "revolt_rocket_okapi", "rocket", "schemars 0.8.22", + "sentry", "serde", "serde_json", "utoipa", diff --git a/crates/core/database/src/voice/mod.rs b/crates/core/database/src/voice/mod.rs index 4542e299..f0bca98c 100644 --- a/crates/core/database/src/voice/mod.rs +++ b/crates/core/database/src/voice/mod.rs @@ -16,7 +16,7 @@ mod voice_client; pub use voice_client::VoiceClient; async fn get_connection() -> Result { - _get_connection().await.to_internal_error() + _get_connection().await.map_err(|_| create_error!(InternalError)) } pub async fn raise_if_in_voice(user: &User, channel_id: &str) -> Result<()> { diff --git a/crates/core/result/Cargo.toml b/crates/core/result/Cargo.toml index b2b2e62e..ebc0764e 100644 --- a/crates/core/result/Cargo.toml +++ b/crates/core/result/Cargo.toml @@ -15,8 +15,9 @@ utoipa = ["dep:utoipa"] rocket = ["dep:rocket", "dep:serde_json"] axum = ["dep:axum", "dep:serde_json"] okapi = ["dep:revolt_rocket_okapi", "dep:revolt_okapi", "schemas"] +sentry = ["dep:sentry"] -default = ["serde"] +default = ["serde", "sentry"] [dependencies] # Serialisation @@ -36,3 +37,5 @@ revolt_okapi = { version = "0.9.1", optional = true } log = "0.4" # Axum axum = { version = "0.7.5", optional = true } + +sentry = { version = "0.31.5", optional = true } \ No newline at end of file diff --git a/crates/core/result/src/lib.rs b/crates/core/result/src/lib.rs index d4331111..77bc0d06 100644 --- a/crates/core/result/src/lib.rs +++ b/crates/core/result/src/lib.rs @@ -226,7 +226,7 @@ pub trait ToRevoltError { fn to_internal_error(self) -> Result; } -impl ToRevoltError for Result { +impl ToRevoltError for Result { #[track_caller] fn to_internal_error(self) -> Result { let loc = Location::caller(); @@ -234,6 +234,8 @@ impl ToRevoltError for Result { self .map_err(|e| { log::error!("{e:?}"); + #[cfg(feature = "sentry")] + sentry::capture_error(&e); Error { error_type: ErrorType::InternalError,