mirror of
https://github.com/Dokploy/dokploy.git
synced 2026-06-15 20:25:23 +02:00
fix(update-database-password): enhance error handling for password update failures
- Improved error messages when updating the database password to provide clearer guidance based on the error type. - Added specific feedback for cases where the database container is not running, prompting users to start the service before attempting to change the password.
This commit is contained in:
@@ -56,12 +56,21 @@ export const UpdateDatabasePassword = ({
|
||||
form.reset();
|
||||
setIsOpen(false);
|
||||
} catch (e) {
|
||||
setError(e instanceof Error ? e.message : "Error updating password");
|
||||
const raw = e instanceof Error ? e.message : "Error updating password";
|
||||
const noContainer = raw.match(/No running container found for \S+/);
|
||||
if (noContainer) {
|
||||
setError(
|
||||
"The database container is not running. Please start the service before changing the password.",
|
||||
);
|
||||
} else {
|
||||
setError(
|
||||
"Error updating password. Please check that the container is running and try again.",
|
||||
);
|
||||
}
|
||||
} finally {
|
||||
setIsPending(false);
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<Dialog
|
||||
open={isOpen}
|
||||
|
||||
@@ -424,7 +424,6 @@ export const postgresRouter = createTRPCRouter({
|
||||
fi
|
||||
docker exec "$CONTAINER_ID" psql -U ${databaseUser} -c "ALTER USER \\"${databaseUser}\\" WITH PASSWORD '${password}';"
|
||||
`;
|
||||
|
||||
if (serverId) {
|
||||
await execAsyncRemote(serverId, command);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user