mirror of
https://github.com/andwati/dokploy.git
synced 2026-11-25 05:08:46 +00: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();
|
form.reset();
|
||||||
setIsOpen(false);
|
setIsOpen(false);
|
||||||
} catch (e) {
|
} 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 {
|
} finally {
|
||||||
setIsPending(false);
|
setIsPending(false);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Dialog
|
<Dialog
|
||||||
open={isOpen}
|
open={isOpen}
|
||||||
|
|||||||
@@ -424,7 +424,6 @@ export const postgresRouter = createTRPCRouter({
|
|||||||
fi
|
fi
|
||||||
docker exec "$CONTAINER_ID" psql -U ${databaseUser} -c "ALTER USER \\"${databaseUser}\\" WITH PASSWORD '${password}';"
|
docker exec "$CONTAINER_ID" psql -U ${databaseUser} -c "ALTER USER \\"${databaseUser}\\" WITH PASSWORD '${password}';"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
if (serverId) {
|
if (serverId) {
|
||||||
await execAsyncRemote(serverId, command);
|
await execAsyncRemote(serverId, command);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user