chore: add temp sentry logging system
This commit is contained in:
1
Cargo.lock
generated
1
Cargo.lock
generated
@@ -6905,6 +6905,7 @@ dependencies = [
|
|||||||
"revolt_rocket_okapi",
|
"revolt_rocket_okapi",
|
||||||
"rocket",
|
"rocket",
|
||||||
"schemars 0.8.22",
|
"schemars 0.8.22",
|
||||||
|
"sentry",
|
||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
"utoipa",
|
"utoipa",
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ mod voice_client;
|
|||||||
pub use voice_client::VoiceClient;
|
pub use voice_client::VoiceClient;
|
||||||
|
|
||||||
async fn get_connection() -> Result<Conn> {
|
async fn get_connection() -> Result<Conn> {
|
||||||
_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<()> {
|
pub async fn raise_if_in_voice(user: &User, channel_id: &str) -> Result<()> {
|
||||||
|
|||||||
@@ -15,8 +15,9 @@ utoipa = ["dep:utoipa"]
|
|||||||
rocket = ["dep:rocket", "dep:serde_json"]
|
rocket = ["dep:rocket", "dep:serde_json"]
|
||||||
axum = ["dep:axum", "dep:serde_json"]
|
axum = ["dep:axum", "dep:serde_json"]
|
||||||
okapi = ["dep:revolt_rocket_okapi", "dep:revolt_okapi", "schemas"]
|
okapi = ["dep:revolt_rocket_okapi", "dep:revolt_okapi", "schemas"]
|
||||||
|
sentry = ["dep:sentry"]
|
||||||
|
|
||||||
default = ["serde"]
|
default = ["serde", "sentry"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
# Serialisation
|
# Serialisation
|
||||||
@@ -36,3 +37,5 @@ revolt_okapi = { version = "0.9.1", optional = true }
|
|||||||
log = "0.4"
|
log = "0.4"
|
||||||
# Axum
|
# Axum
|
||||||
axum = { version = "0.7.5", optional = true }
|
axum = { version = "0.7.5", optional = true }
|
||||||
|
|
||||||
|
sentry = { version = "0.31.5", optional = true }
|
||||||
@@ -226,7 +226,7 @@ pub trait ToRevoltError<T> {
|
|||||||
fn to_internal_error(self) -> Result<T, Error>;
|
fn to_internal_error(self) -> Result<T, Error>;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T, E: std::fmt::Debug> ToRevoltError<T> for Result<T, E> {
|
impl<T, E: std::fmt::Debug + std::error::Error> ToRevoltError<T> for Result<T, E> {
|
||||||
#[track_caller]
|
#[track_caller]
|
||||||
fn to_internal_error(self) -> Result<T, Error> {
|
fn to_internal_error(self) -> Result<T, Error> {
|
||||||
let loc = Location::caller();
|
let loc = Location::caller();
|
||||||
@@ -234,6 +234,8 @@ impl<T, E: std::fmt::Debug> ToRevoltError<T> for Result<T, E> {
|
|||||||
self
|
self
|
||||||
.map_err(|e| {
|
.map_err(|e| {
|
||||||
log::error!("{e:?}");
|
log::error!("{e:?}");
|
||||||
|
#[cfg(feature = "sentry")]
|
||||||
|
sentry::capture_error(&e);
|
||||||
|
|
||||||
Error {
|
Error {
|
||||||
error_type: ErrorType::InternalError,
|
error_type: ErrorType::InternalError,
|
||||||
|
|||||||
Reference in New Issue
Block a user