-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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
vscode debugger stops on reject() #1746
Comments
I've verified that node.js sends indeed a break event with an 'undefined' exception for the reject(), so the behavior is correct. |
Any advance in this? |
I'm having the same issue in vscode v1.6. if I run the below code using the cmd line // app.js
function test(shouldReject) {
return new Promise((resolve, reject) => {
shouldReject ? reject("rejected") : resolve("resolved")
})
}
let shouldReject = true
test(shouldReject)
.then(result => console.log(result))
.catch(err => console.log(err)); // commenting this line will cause nodejs to throw UnhandledPromiseRejectionWarning Would be nice if vscode debugger replicated the same behaviour as |
@pflannery please try to use our new experimental node debugger by setting the debug type to "node2" (and you will have to use a node.js version >= 6.3). |
@roblourens when trying the snippet from above with node2, I stop in line 4 on a "debugger statement" (whereas node-debug stops on an exception). |
VS Code 1.7 tries to identify exceptions that result from rejects() and skips them if the 'All Exceptions' checkbox is not set. /cc @roblourens |
Hm, I see the problem, but I'd rather keep Chrome DevTools' behavior here for node2. I think it's something that would have to be addressed on the runtime side. With this change, you could have a false positive and skip a line just because it happens to have the word 'reject' on it. You could also have the callback named something other than 'reject'. And at that point, you don't know whether the rejection is handled, so you could be skipping an unhandled promise rejection. |
@roblourens fair points... I will disable this feature for now. @a8775 @DryRuskFromLS @pflannery I will leave this feature request closed since there is already a way to prevent the debugger from stopping on reject() by means of the 'uncaught Exceptions' checkbox (and I cannot do more with the limitations of the now obsolete v8 debugger protocol). |
Good points @weinand, I filed an issue to look at that in node-debug2 |
Hello there. I am still facing this issue. My VSCode is 1.7.2 and if I have If I unselect it I no longer receive it. But obviously I do not want Am I doing some thing wrong? Here is a screenshot of vscode with a break happening on a reject without having a specified breakpoint for it. |
@linvi what you are seeing is the native node.js behavior. Please read my comment #1746 (comment). |
@weinand does that mean node is overriding its own native behaviour when running |
|
I think I'm observing the same issue here. VS Code stops here on every page load. When I step over the marked line the fetchPromise has the status "rejected". I'm running VS Code 1.8.0, Commit 3874693, Shell 1.4.6, Renderer 53.0.2785.143, Node 6.5.0 |
I am having this problem too with 1.9.1, zonejs 0.7.6. I tried to all the combination of put empty string into the fetch and/or toggle chrome pause on caught exception with no luck. I don't understand such a simple thing cannot be resolved. Either fixing zonejs.fetch or ignore it from vscode. Is this because both are free open source stuff? |
I want to break on rejected promises but not all exceptions. I am trying to debug a gulp build that is failing with a (nondescript) promise rejection. If I set the debugger to break on Uncaught Exceptions, it never breaks. If I set the debugger to break on All Exceptions, it breaks every time the build tries to stat a file (1000s of times). There appears to be no way to break on promise rejections. |
I have this issue using My question : is there a project setting I can use to disable the I tried using
But VSCode still breaks when Is there a way/workaround/anything other than manually uncheck |
@electrotype take a look at this SO question |
Thanks @Olian04 . Sadly, I don't want to disable debugging on this project.... I need to start it in debug mode. I really wish there was a project setting to disable |
@electrotype If you uncheck "Uncaught Exceptions", it should stay unchecked in that workspace until you check it again.
This is the same behavior as "blackbox script" in chrome devtools. |
Thanks for the info @roblourens . But we are a big team : people checkout the project and run it as adviced... That "error" doesn't look good at all! I now have to ask them to uncheck |
Another possibility would be continuing automatically from files in skipFiles (like smartStep) so we can skip uncaught exceptions which aren't really, since Chrome still pauses there even in blackboxed scripts. |
Let's investigate this in December. |
I changed the "uncaught exceptions" default to |
I have this problem as well using Node's const { promisify } = require('util')
function bar(callback) {
callback(new Error('just cause'))
}
async function foo() {
try {
await promisify(bar)()
} catch (error) {
console.log(error.message)
}
}
foo() |
Unfortunately I don't have any better solution here. The 'undefined' mentioned in the OP is technically correct for that case. The issue of node sending the wrong pause reason has been fixed, so now the call stack label is correct. My investigation in microsoft/vscode-node-debug2#46 is another explanation of what's happening. My suggestion of
I would consider out of scope for now. I think we will have to wait for better support from the runtime regarding "break on exception" for async-handled exceptions. |
Node 4.5.103.35, vscode: 0.10.6
Debuger stops on
reject()
, with message "Paused on exception" without exception details, no breakpoints are set except "uncaught exception".The text was updated successfully, but these errors were encountered: