always panic() when in debugging mode

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2019-05-26 03:13:09 -07:00
parent 58fe5021bc
commit f87f785a6b
1 changed files with 11 additions and 6 deletions

17
main.go
View File

@ -311,18 +311,23 @@ func mainMouseClick(b *gui.ButtonMap) {
}
}
//
// Doing this can sometimes avoid a panic() on things like:
// panic: runtime error: slice bounds out of range
//
// In debugging mode, always panic() and never try to recover()
//
func r() {
if r := recover(); r != nil {
fmt.Println("recover() SOMETHING IS REALLY BROKEN r =", r)
fmt.Println("recover() SOMETHING IS REALLY BROKEN r =", r)
fmt.Println("recover() SOMETHING IS REALLY BROKEN r =", r)
if (gui.Data.Debug == false) {
if r := recover(); r != nil {
log.Println("recover() SOMETHING IS REALLY BROKEN r =", r)
log.Println("recover() SOMETHING IS REALLY BROKEN r =", r)
log.Println("recover() SOMETHING IS REALLY BROKEN r =", r)
}
}
}
func prepareAndSend(event *pb.Event) {
if (event.Account == nil) {
log.Println("\tmain.prepareAndSend() ERROR event.Token = nil")
@ -330,7 +335,7 @@ func prepareAndSend(event *pb.Event) {
log.Println("\tmain.prepareAndSend() ERROR event.Token = nil")
} else {
s := event.Account.Token
log.Println("\tmain.prepareAndSend() event.Token(-24:) =", s[len(s)-24:])
log.Println("\tmain.prepareAndSend() event.Token(-24:) =", s[-24:]) // substr slice
}
gorillaSendProtobuf(event)
gui.Data.State = "READ PROTOBUF"