Fix sentry http request info
Add async bot running with semaphore
This commit is contained in:
+12
-2
@@ -1,6 +1,6 @@
|
||||
use anyhow::anyhow;
|
||||
use axum::response::IntoResponse;
|
||||
use reqwest::StatusCode;
|
||||
use tracing::error;
|
||||
|
||||
#[derive(thiserror::Error, Debug)]
|
||||
pub enum AppError {
|
||||
@@ -22,6 +22,9 @@ pub enum AppError {
|
||||
#[error("WebHook have bad action")]
|
||||
InvalidActionErr,
|
||||
|
||||
#[error("Channel full")]
|
||||
ChannelFullErr,
|
||||
|
||||
#[error(transparent)]
|
||||
BadJsonStructErr(#[from] serde_json::Error),
|
||||
|
||||
@@ -55,8 +58,15 @@ impl IntoResponse for AppError {
|
||||
StatusCode::UNAUTHORIZED,
|
||||
"WebHook sig header is invalid".to_string(),
|
||||
),
|
||||
AppError::ChannelFullErr => {
|
||||
sentry_anyhow::capture_anyhow(&anyhow!("Max concurrent tasks reached"));
|
||||
(
|
||||
StatusCode::SERVICE_UNAVAILABLE,
|
||||
"Max concurrent tasks reached".to_string(),
|
||||
)
|
||||
}
|
||||
AppError::Other(err) => {
|
||||
error!(%err, "Internal server error");
|
||||
sentry_anyhow::capture_anyhow(&err);
|
||||
(
|
||||
StatusCode::INTERNAL_SERVER_ERROR,
|
||||
"Internal server error".to_string(),
|
||||
|
||||
Reference in New Issue
Block a user