bots-house / share-file-bot

☁️ Share anything using Telegram as Cloud
https://t.me/share_file_bot
MIT License
24 stars 9 forks source link

Handle Chat Already Connected #44

Closed sentry-io[bot] closed 3 years ago

sentry-io[bot] commented 3 years ago
  1. Reproduce this error
  2. Handle this error and return normal error message

Sentry Issue: SHARE-FILE-BOT-Q

*pq.Error: pq: duplicate key value violates unique constraint "chat_owner_id_telegram_id_key"
*errors.withMessage: dal: unable to insert into chat: pq: duplicate key value violates unique constraint "chat_owner_id_telegram_id_key"
*errors.withStack: dal: unable to insert into chat: pq: duplicate key value violates unique constraint "chat_owner_id_telegram_id_key"
  File "/go/src/github.com/bots-house/share-file-bot/store/postgres/dal/chat.go", line 798, in (*Chat).Insert
  File "/go/src/github.com/bots-house/share-file-bot/store/postgres/base.go", line 73, in (*BaseStore).insertOne
  File "/go/src/github.com/bots-house/share-file-bot/store/postgres/chat.go", line 63, in (*ChatStore).Add
  File "/go/src/github.com/bots-house/share-file-bot/service/chat.go", line 130, in (*Chat).Add
  File "/go/src/github.com/bots-house/share-file-bot/bot/handler_settings_channels_and_chats.go", line 375, in (*Bot).onSettingsChannelsAndChatsConnectState
...
(9 additional frame(s) were not displayed)

*errors.withMessage: insert query: dal: unable to insert into chat: pq: duplicate key value violates unique constraint "chat_owner_id_telegram_id_key"
*errors.withStack: insert query: dal: unable to insert into chat: pq: duplicate key value violates unique constraint "chat_owner_id_telegram_id_key"
  File "/go/src/github.com/bots-house/share-file-bot/store/postgres/chat.go", line 64, in (*ChatStore).Add
  File "/go/src/github.com/bots-house/share-file-bot/service/chat.go", line 130, in (*Chat).Add
  File "/go/src/github.com/bots-house/share-file-bot/bot/handler_settings_channels_and_chats.go", line 375, in (*Bot).onSettingsChannelsAndChatsConnectState
  File "/go/src/github.com/bots-house/share-file-bot/bot/bot.go", line 135, in (*Bot).onUpdate
  File "/go/src/github.com/bots-house/share-file-bot/pkg/tg/handler.go", line 16, in HandlerFunc.HandleUpdate
...
(7 additional frame(s) were not displayed)

*errors.withMessage: add chat to store: insert query: dal: unable to insert into chat: pq: duplicate key value violates unique constraint "chat_owner_id_telegram_id_key"
*errors.withStack: add chat to store: insert query: dal: unable to insert into chat: pq: duplicate key value violates unique constraint "chat_owner_id_telegram_id_key"
  File "/go/src/github.com/bots-house/share-file-bot/service/chat.go", line 131, in (*Chat).Add
  File "/go/src/github.com/bots-house/share-file-bot/bot/handler_settings_channels_and_chats.go", line 375, in (*Bot).onSettingsChannelsAndChatsConnectState
  File "/go/src/github.com/bots-house/share-file-bot/bot/bot.go", line 135, in (*Bot).onUpdate
  File "/go/src/github.com/bots-house/share-file-bot/pkg/tg/handler.go", line 16, in HandlerFunc.HandleUpdate
  File "/go/src/github.com/bots-house/share-file-bot/bot/middleware.go", line 90, in newAuthMiddleware.func1.1
...
(6 additional frame(s) were not displayed)

*errors.withMessage: add chat: add chat to store: insert query: dal: unable to insert into chat: pq: duplicate key value violates unique constraint "chat_owner_id_telegram_id_key"
*errors.withStack: add chat: add chat to store: insert query: dal: unable to insert into chat: pq: duplicate key value violates unique constraint "chat_owner_id_telegram_id_key"
  File "/go/src/github.com/bots-house/share-file-bot/bot/handler_settings_channels_and_chats.go", line 389, in (*Bot).onSettingsChannelsAndChatsConnectState
  File "/go/src/github.com/bots-house/share-file-bot/bot/bot.go", line 135, in (*Bot).onUpdate
  File "/go/src/github.com/bots-house/share-file-bot/pkg/tg/handler.go", line 16, in HandlerFunc.HandleUpdate
  File "/go/src/github.com/bots-house/share-file-bot/bot/middleware.go", line 90, in newAuthMiddleware.func1.1
  File "/go/src/github.com/bots-house/share-file-bot/pkg/tg/handler.go", line 16, in HandlerFunc.HandleUpdate
...
(5 additional frame(s) were not displayed)