Skip to content

Commit

Permalink
Merge pull request #23670 from michelkaporin/exception-widget
Browse files Browse the repository at this point in the history
Exception widget UI update with respect to DA protocol
  • Loading branch information
isidorn authored Mar 30, 2017
2 parents 9ee6801 + be6caec commit 03748e7
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 32 deletions.
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

0 comments on commit 03748e7

Please sign in to comment.