Print stacktrace for debug

This commit is contained in:
akostin 2018-05-11 15:37:55 +03:00
parent eb0d359b06
commit bf6f2a519d

View File

@ -14,6 +14,7 @@ import (
"log" "log"
"os" "os"
"path/filepath" "path/filepath"
"runtime/debug"
"strconv" "strconv"
"strings" "strings"
"sync" "sync"
@ -372,7 +373,7 @@ func logic(key string, value map[string]interface{}, bitdir *string, with_label
defer wg.Done() defer wg.Done()
defer func() { defer func() {
if r := recover(); r != nil { if r := recover(); r != nil {
errChannel <- fmt.Sprintf("Panic while processing torrent %v. Text panic: %v", key, r) errChannel <- fmt.Sprintf("Panic while processing torrent %v:\n======\nReason: %v.\nText panic:\n%v\n======", key, r, string(debug.Stack()))
} }
}() }()
var err error var err error