Skip to content
This repository has been archived by the owner on Oct 12, 2022. It is now read-only.

Debugger pausing on Exception but not telling me what the Exception is #94

Closed
Jakobud opened this issue Sep 18, 2016 · 3 comments
Closed
Assignees
Milestone

Comments

@Jakobud
Copy link

Jakobud commented Sep 18, 2016

I'm debugging an extension. I have the following (JS file):

let myFunction = () => {

  return new Promise((resolve, reject)=> {

    if (someArray.length === 0) {

      vscode.window.showInformationMessage('There was a problem');
      reject("There was a problem");  // <-- Debugger is pausing on this line, but not showing an Exception

    } else {

      // .... do some other stuff

      resolve("Success!!");

    }

  });   

}

let myCommand = () => {

  myFunction()
  .then((value) => {
    console.log(value);
  }).reject((err)=> {
    console.error(err);
  });

}

So with the above code, when I attempt to reject a value in that Promise, the debugger always pauses there saying there is an exception. But I don't see any actual exception specified anywhere in the debug sidebar or debug console. Is there something about the debugger that I'm not understand. And I have no clue why the reject command is pausing. If I continue the debugging, the command finishes as expected without error. So I don't understand that either.

screenshot 121

@Jakobud
Copy link
Author

Jakobud commented Sep 18, 2016

Okay I figured out why I was getting an exception. Something to do with fact that I was trying to do a synchronous rejection. This fixed it:

vscode.window.showInformationWindow(...)
  .then(()=>{ reject(...); });

But I'm still confused on why the debugger will stop for an exception but not actually tell you what the exception is.

@Jakobud
Copy link
Author

Jakobud commented Sep 18, 2016

Also I found this:

http://stackoverflow.com/questions/39063281/typescript-promise-rejecting-and-vscode-debugger-behavior

So is this a bug that VSCode has issues with synchronous Promise rejections?

@weinand weinand self-assigned this Oct 10, 2016
@weinand
Copy link
Contributor

weinand commented Oct 24, 2016

Please see microsoft/vscode#1746 for an analysis and possible workarounds.

@weinand weinand closed this as completed Oct 24, 2016
@weinand weinand removed the bug label Oct 24, 2016
@weinand weinand added this to the October 2016 milestone Oct 24, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants