Retry the fix

This commit is contained in:
jude 2025-03-20 16:56:10 +00:00
parent c0583f2d43
commit 265e48f84b
2 changed files with 39 additions and 31 deletions

View File

@ -32,6 +32,12 @@ export const EditButtonRow = () => {
setRecentlySaved(false);
flash({ message: response.data.error, type: "error" });
} else if (response.data.errors && response.data.errors.length > 0) {
setRecentlySaved(false);
for (const error of response.data.errors) {
flash({ message: error, type: "error" });
}
} else {
setRecentlySaved(true);

View File

@ -274,9 +274,8 @@ pub async fn edit_reminder(
reminder.channel, id
);
return Err(json!({"error": "Channel not found"}));
}
error.push("Channel not found".to_string());
} else {
let channel = create_database_channel(
ctx.inner(),
ChannelId::new(reminder.channel),
@ -284,16 +283,8 @@ pub async fn edit_reminder(
)
.await;
if let Err(e) = channel {
warn!("`create_database_channel` returned an error code: {:?}", e);
return Err(
json!({"error": "Failed to configure channel for reminders. Please check the bot permissions"}),
);
}
let channel = channel.unwrap();
match channel {
Ok(channel) => {
match sqlx::query!(
"UPDATE reminders SET channel_id = ? WHERE uid = ?",
channel,
@ -311,20 +302,31 @@ pub async fn edit_reminder(
}
}
Err(e) => {
warn!("`create_database_channel` returned an error code: {:?}", e);
error.push("Failed to configure channel for reminders. Please check the bot permissions".to_string());
}
}
}
}
None => {
warn!(
"Error in `edit_reminder`: channel {:?} not found for guild {}",
reminder.channel, id
);
return Err(json!({"error": "Channel not found"}));
error.push("Channel not found".to_string());
}
}
}
if let Err(e) = transaction.commit().await {
warn!("Couldn't commit transaction: {:?}", e);
return json_err!("Couldn't commit transaction");
return Err(
json!({"reminder": Option::<GetReminder>::None, "errors": vec!["Unknown error"]}),
);
}
match sqlx::query_as_unchecked!(