Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DAP errors when setting breakpoints are not respected #89059

Closed
connor4312 opened this issue Jan 21, 2020 · 5 comments
Closed

DAP errors when setting breakpoints are not respected #89059

connor4312 opened this issue Jan 21, 2020 · 5 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug debug Debug viewlet, configurations, breakpoints, adapter issues verified Verification succeeded
Milestone

Comments

@connor4312
Copy link
Member

connor4312 commented Jan 21, 2020

I wanted to validate logpoint breakpoint syntax in js-debug when setting the breakpoint. Plenty of times I have tried setting a breakpoint and only later realized it didn't get hit because I was missing a quotation mark. However it appears that errors in setBreakpoints aren't handled. I send back this error:

{id: 9231, format: 'Unexpected token 'const'', showUser: true}

It doesn't get shown to the user, and I see this in the window log:

[2020-01-21 15:35:26.072] [renderer6] [error] Error processing setBreakpoints: undefined: Error: Error processing setBreakpoints: undefined
    at t.RawDebugSession.handleErrorResponse (file:///Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:2875:728)
    at file:///Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:2875:159
    at async R.sendBreakpoints (file:///Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:5486:707)
    at async Promise.all (index 1)
    at async j.sendToOneOrAllSessions (file:///Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:5517:343)
    at async j.enableOrDisableBreakpoints (file:///Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:5514:374)
connor4312 added a commit to microsoft/vscode-js-debug that referenced this issue Jan 21, 2020
Fixes #226. As suggested in the original issue, we use the TS parser
to parse the code inside the {} 'blocks', which lets us handle more
complex expressions. We also now support multiple statements, and
(try to) return the last one, and log the stacks of any thrown errors
rather than silently failing. Finally, we return a verbose error to the
user in the event that their logpoint isn't valid JS, though there's
an issue with VS Code right now: microsoft/vscode#89059
@connor4312 connor4312 added the debug Debug viewlet, configurations, breakpoints, adapter issues label Jan 21, 2020
@connor4312
Copy link
Member Author

you can verify this by pulling down the branch in the linked PR, and then setting a logpoint like {return const a = b + c}

connor4312 added a commit to microsoft/vscode-js-debug that referenced this issue Jan 22, 2020
* feat: make logpoint parsing more resilient

Fixes #226. As suggested in the original issue, we use the TS parser
to parse the code inside the {} 'blocks', which lets us handle more
complex expressions. We also now support multiple statements, and
(try to) return the last one, and log the stacks of any thrown errors
rather than silently failing. Finally, we return a verbose error to the
user in the event that their logpoint isn't valid JS, though there's
an issue with VS Code right now: microsoft/vscode#89059

* fixup! pr comments
@weinand weinand assigned isidorn and unassigned weinand Feb 4, 2020
@weinand weinand added the bug Issue identified by VS Code Team member as probable bug label Feb 4, 2020
@weinand weinand added this to the February 2020 milestone Feb 4, 2020
@isidorn isidorn closed this as completed in fc6e8fd Feb 5, 2020
@isidorn
Copy link
Contributor

isidorn commented Feb 5, 2020

@connor4312 Thanks for filling this issue.
The problem was that we were nowhere respecting the showUser flag in the error response and thus those errors were not being shown to the user.
Now we respect that flag and as soon as we get the response with that flag we show it to the user.

Please try it out and let me know how it behaves. Thank you!

@connor4312
Copy link
Member Author

Hm, I see the error now shown property in the console log of the workbench...

image

But I don't see any message displayed to me. This is the full request/response:

{
  "command": "setBreakpoints",
  "arguments": {
    "source": {
      "name": "main.js",
      "path": "/Users/copeet/Github/vscode-pwa/demos/node/main.js",
      "sourceReference": 0
    },
    "lines": [
      23
    ],
    "breakpoints": [
      {
        "line": 23,
        "logMessage": "hello {'world}"
      }
    ],
    "sourceModified": false
  },
  "type": "request",
  "seq": 12
}

{
  "seq": 117,
  "type": "response",
  "request_seq": 12,
  "command": "setBreakpoints",
  "success": false,
  "body": {
    "error": {
      "id": 9231,
      "format": "Invalid or unexpected token",
      "showUser": true
    }
  }
}

@connor4312 connor4312 reopened this Feb 7, 2020
@connor4312
Copy link
Member Author

Nevermind, I was behind on insiders, I had to restart twice to get the very latest version. It works here :)

@connor4312 connor4312 added the verified Verification succeeded label Feb 7, 2020
@isidorn
Copy link
Contributor

isidorn commented Feb 10, 2020

Thanks for verifying and leting me know!

@vscodebot vscodebot bot locked and limited conversation to collaborators Mar 23, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug debug Debug viewlet, configurations, breakpoints, adapter issues verified Verification succeeded
Projects
None yet
Development

No branches or pull requests

3 participants