From eb30f8584664fa0bae2587634db5da725318d769 Mon Sep 17 00:00:00 2001 From: stefanodvx <69367859+stefanodvx@users.noreply.github.com> Date: Tue, 15 Apr 2025 19:12:24 +0200 Subject: [PATCH] fix errors handlig --- bot/core/util.go | 4 ++-- bot/main.go | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/bot/core/util.go b/bot/core/util.go index b487852..f484204 100644 --- a/bot/core/util.go +++ b/bot/core/util.go @@ -199,8 +199,8 @@ func HandleErrorMessage( ) { currentError := err - if errors.As(currentError, context.Canceled) || - errors.As(currentError, context.DeadlineExceeded) { + if errors.Is(currentError, context.Canceled) || + errors.Is(currentError, context.DeadlineExceeded) { SendErrorMessage( bot, ctx, "download request canceled or timed out", diff --git a/bot/main.go b/bot/main.go index 4d8314d..0e251bb 100644 --- a/bot/main.go +++ b/bot/main.go @@ -3,6 +3,7 @@ package bot import ( "log" "os" + "runtime/debug" "strconv" "time" @@ -53,7 +54,8 @@ func Start() { }, Panic: func(b *gotgbot.Bot, ctx *ext.Context, r interface{}) { 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,