dap: suppress error popup for failed evaluation request in repl mode (#2420)
It's expected that users enter invalid expressions through DEBUG CONSOLE. Pop up for every error is not pleasant.
This commit is contained in:
parent
79e6f7fa90
commit
8b20609227
@ -1272,7 +1272,7 @@ func (s *Server) convertVariableWithOpts(v *proc.Variable, qualifiedNameOrExpr s
|
||||
// variables, so consider also adding the following:
|
||||
// -- print {expression} - return the result as a string like from dlv cli
|
||||
func (s *Server) onEvaluateRequest(request *dap.EvaluateRequest) {
|
||||
showErrorToUser := request.Arguments.Context != "watch"
|
||||
showErrorToUser := request.Arguments.Context != "watch" && request.Arguments.Context != "repl"
|
||||
if s.debugger == nil {
|
||||
s.sendErrorResponseWithOpts(request.Request, UnableToEvaluateExpression, "Unable to evaluate expression", "debugger is nil", showErrorToUser)
|
||||
return
|
||||
|
||||
@ -197,7 +197,7 @@ func TestLaunchStopOnEntry(t *testing.T) {
|
||||
|
||||
// 10 >> evaluate, << error
|
||||
client.EvaluateRequest("foo", 0 /*no frame specified*/, "repl")
|
||||
erResp := client.ExpectVisibleErrorResponse(t)
|
||||
erResp := client.ExpectErrorResponse(t)
|
||||
if erResp.Seq != 0 || erResp.RequestSeq != 10 || erResp.Body.Error.Id != 2009 {
|
||||
t.Errorf("\ngot %#v\nwant Seq=0, RequestSeq=10 Id=2009", erResp)
|
||||
}
|
||||
@ -323,7 +323,7 @@ func TestAttachStopOnEntry(t *testing.T) {
|
||||
|
||||
// 10 >> evaluate, << error
|
||||
client.EvaluateRequest("foo", 0 /*no frame specified*/, "repl")
|
||||
erResp := client.ExpectVisibleErrorResponse(t)
|
||||
erResp := client.ExpectErrorResponse(t)
|
||||
if erResp.Seq != 0 || erResp.RequestSeq != 10 || erResp.Body.Error.Id != 2009 {
|
||||
t.Errorf("\ngot %#v\nwant Seq=0, RequestSeq=10 Id=2009", erResp)
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user