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

Exception widget UI update with respect to DA protocol #23670

Merged
merged 3 commits into from
Mar 30, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 28 additions & 31 deletions src/vs/workbench/parts/debug/browser/exceptionWidget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ export class ExceptionWidget extends ZoneWidget {

private _backgroundColor: Color;


constructor(editor: ICodeEditor, private exceptionInfo: IExceptionInfo, private lineNumber: number,
@IContextViewService private contextViewService: IContextViewService,
@IDebugService private debugService: IDebugService,
Expand Down Expand Up @@ -69,38 +68,36 @@ export class ExceptionWidget extends ZoneWidget {
this.container.style.lineHeight = `${fontInfo.lineHeight}px`;

let title = $('.title');
let msg = $('.message');
const defaultConditionMessage = nls.localize('exceptionThrown', 'Exception has occurred.');

if (this.exceptionInfo.breakMode) {
let conditionMessage;
switch (this.exceptionInfo.breakMode) {
case 'never':
conditionMessage = nls.localize('neverException', 'User-handled exception has occurred.');
break;
case 'always':
conditionMessage = nls.localize('alwaysException', 'Always-breaking exception has occurred.');
break;
case 'unhandled':
conditionMessage = nls.localize('unhandledException', 'Unhandled exception has occurred.');
break;
case 'userUnhandled':
conditionMessage = nls.localize('userUnhandledException', 'User-unhandled exception has occurred.');
break;
default:
conditionMessage = defaultConditionMessage;
break;
}

title.textContent = `${conditionMessage} ${this.exceptionInfo.description}`;
msg.textContent = this.exceptionInfo.details.stackTrace;
} else {
title.textContent = defaultConditionMessage;
msg.textContent = this.exceptionInfo.description;
switch (this.exceptionInfo.breakMode) {
case 'never':
title.textContent = nls.localize('neverException', 'User-handled exception has occurred: {0}', this.exceptionInfo.id);
break;
case 'always':
title.textContent = nls.localize('alwaysException', 'Always-breaking exception has occurred: {0}', this.exceptionInfo.id);
break;
case 'unhandled':
title.textContent = nls.localize('unhandledException', 'Unhandled exception has occurred: {0}', this.exceptionInfo.id);
break;
case 'userUnhandled':
title.textContent = nls.localize('userUnhandledException', 'User-unhandled exception has occurred: {0}', this.exceptionInfo.id);
break;
default:
title.textContent = this.exceptionInfo.id ? nls.localize('exceptionThrownWithId', 'Exception has occurred: {0}', this.exceptionInfo.id) : nls.localize('exceptionThrown', 'Exception has occurred.');
break;
}

dom.append(container, title);
dom.append(container, msg);

if (this.exceptionInfo.description) {
let description = $('.description');
description.textContent = this.exceptionInfo.description;
dom.append(container, description);
}

if (this.exceptionInfo.details && this.exceptionInfo.details.stackTrace) {
let stackTrace = $('.stack-trace');
stackTrace.textContent = this.exceptionInfo.details.stackTrace;
dom.append(container, stackTrace);
}
}

protected _doLayout(heightInPixel: number, widthInPixel: number): void {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,12 @@
font-weight: bold;
}

.monaco-editor .zone-widget .zone-widget-container.exception-widget .message {
.monaco-editor .zone-widget .zone-widget-container.exception-widget .description,
.monaco-editor .zone-widget .zone-widget-container.exception-widget .stack-trace {
font-family: Monaco, Menlo, Consolas, "Droid Sans Mono", "Inconsolata", "Courier New", monospace, "Droid Sans Fallback";
}

.monaco-editor .zone-widget .zone-widget-container.exception-widget .stack-trace {
margin-top: 0.5em;
}

Expand Down