Report chats that already exist; do not panic.

This commit is contained in:
Benjamin A. Shelton 2026-10-14 23:57:40 -06:00
commit 06557c021e
Signed by: zancarius
GPG key ID: 8BD42DBD6C337E01

View file

@ -33,6 +33,10 @@ func (c *chats) AddChat(ctx context.Context, cmd *cli.Command) error {
mdl := models.NewChatModel(ctx, mdb.DB())
_, err := mdl.AddChat(id, name)
if err != nil {
if errors.Is(err, models.ErrUniqueConstraint) {
logger.Error("chat exists")
return nil
}
return err
}
fmt.Printf(`added chat "%s" (%d)\n`, name, id)