service/dap: log stacktrace when panic is recovered (#2457)
This commit is contained in:
parent
35d4f05c4e
commit
ef337d3022
@ -21,6 +21,7 @@ import (
|
|||||||
"reflect"
|
"reflect"
|
||||||
"regexp"
|
"regexp"
|
||||||
"runtime"
|
"runtime"
|
||||||
|
"runtime/debug"
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
@ -318,6 +319,7 @@ func (s *Server) handleRequest(request dap.Message) {
|
|||||||
// In case a handler panics, we catch the panic and send an error response
|
// In case a handler panics, we catch the panic and send an error response
|
||||||
// back to the client.
|
// back to the client.
|
||||||
if ierr := recover(); ierr != nil {
|
if ierr := recover(); ierr != nil {
|
||||||
|
s.log.Errorf("stacktrace from recovered panic:\n%s\n", debug.Stack())
|
||||||
s.sendInternalErrorResponse(request.GetSeq(), fmt.Sprintf("%v", ierr))
|
s.sendInternalErrorResponse(request.GetSeq(), fmt.Sprintf("%v", ierr))
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user