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

Surfacing new Exception DAP in UI #22948

Merged
merged 6 commits into from
Mar 22, 2017
Merged

Surfacing new Exception DAP in UI #22948

merged 6 commits into from
Mar 22, 2017

Conversation

michelkaporin
Copy link
Contributor

Added support for querying the debug adapter for the exception info.

Implements #22078

@msftclas
Copy link

@michelkaporin,
Thanks for having already signed the Contribution License Agreement. Your agreement was validated by Microsoft. We will now review your pull request.
Thanks,
Microsoft Pull Request Bot

return session.exceptionInfo({ threadId: this.threadId });
}

return null;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can not just return null when a promise is expected, you should
return TPromise.as(null)

@@ -77,6 +77,7 @@ export interface IExpression extends ITreeElement, IExpressionContainer {

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good

@@ -323,6 +323,10 @@ export class RawDebugSession extends v8.V8Protocol implements debug.ISession {
return this.send('stackTrace', args);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good

@@ -120,6 +120,15 @@ export class MockSession implements debug.ISession {
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good

conditionMessage = nls.localize('userUnhandledException', 'User-unhandled exception has occurred.');
break;
default:
conditionMessage = '';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer if the default case had the same Exception occurred message as the case when there is no exceptionInfo

break;
}

title.textContent = `${conditionMessage} ${this.exceptionInfo.body.description}`;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are missing a colon here between the condition message and the description

Copy link
Contributor Author

@michelkaporin michelkaporin Mar 22, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I remember we agreed on putting a colon there, but I did not put it explicitly and used a dot on the conditionMessage instead, because description itself contains a colon after the exception type, so that it ends up as Unhandled exception has occurred: Error: test message which looks ugly with two colons in my opinion.
So currently it is printed like that:
Unhandled exception has occurred. Error: test message
Although I can use quotes on the description to make it look better with two colons:
Unhandled exception has occurred: 'Error: test message'

What do you think is better?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's how it looks now:

image

* Returns exception info promise if the exception was thrown and the debug adapter supports 'exceptionInfo' request, otherwise null
*/
public get exceptionInfo(): TPromise<DebugProtocol.ExceptionInfoResponse> {
const session = this.process.session;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would love if the exception widget always calls this method.
And all the logic is in this method, meaning that if we are not stopped we return null, if the session does not supportExceptionInfoRequest we also return something

* Returns exception info promise if the exception was thrown and the debug adapter supports 'exceptionInfo' request, otherwise null
*/
public get exceptionInfo(): TPromise<DebugProtocol.ExceptionInfoResponse> {
const session = this.process.session;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We might need to introduce an interface on our side as a pair of adapter protocol exception interface - to get rid of the body and to handle the case when the session does not support exception request

@michelkaporin
Copy link
Contributor Author

Cheers @isidorn, I've amended the code per your comments.

*/
public get exceptionInfo(): TPromise<DebugProtocol.ExceptionInfoResponse> {
const session = this.process.session;
if (session.capabilities.supportsExceptionInfoRequest && this.stoppedDetails && this.stoppedDetails.reason === 'exception') {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not like this check for this.stoppedDetails and this.stoppedDetails.reason === 'exception' since now we do it two times. Once before calling this method and once in the method.

We should do it in only one of those places - whichever feels better to you.
You just have to figure out what is the contract of this method and when should it be calle

@isidorn isidorn merged commit 27ca195 into microsoft:master Mar 22, 2017
@isidorn
Copy link
Contributor

isidorn commented Mar 22, 2017

@michelkaporin great job, merging in 🍻

@github-actions github-actions bot locked and limited conversation to collaborators Mar 27, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants