fix errors handlig
This commit is contained in:
parent
b4b371e0db
commit
eb30f85846
2 changed files with 5 additions and 3 deletions
|
@ -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",
|
||||||
|
|
|
@ -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,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue