fix errors handlig

This commit is contained in:
stefanodvx 2025-04-15 19:12:24 +02:00
parent b4b371e0db
commit eb30f85846
2 changed files with 5 additions and 3 deletions

View file

@ -199,8 +199,8 @@ func HandleErrorMessage(
) { ) {
currentError := err currentError := err
if errors.As(currentError, context.Canceled) || if errors.Is(currentError, context.Canceled) ||
errors.As(currentError, context.DeadlineExceeded) { errors.Is(currentError, context.DeadlineExceeded) {
SendErrorMessage( SendErrorMessage(
bot, ctx, bot, ctx,
"download request canceled or timed out", "download request canceled or timed out",

View file

@ -3,6 +3,7 @@ package bot
import ( import (
"log" "log"
"os" "os"
"runtime/debug"
"strconv" "strconv"
"time" "time"
@ -53,7 +54,8 @@ func Start() {
}, },
Panic: func(b *gotgbot.Bot, ctx *ext.Context, r interface{}) { Panic: func(b *gotgbot.Bot, ctx *ext.Context, r interface{}) {
if logDispatcherErrors { if logDispatcherErrors {
log.Printf("panic occurred while handling update: %v", r) log.Printf("panic occurred while handling update: %v\n", r)
log.Printf("stack trace:\n%s\n", debug.Stack())
} }
}, },
MaxRoutines: concurrentUpdates, MaxRoutines: concurrentUpdates,