blueslip: Show more-info context in alert popup, if we have it.

This commit is contained in:
Alex Vandiver 2023-04-21 21:00:59 +00:00 committed by Tim Abbott
parent 5d97dbf8b3
commit 1769f981da
4 changed files with 22 additions and 0 deletions

View File

@ -128,8 +128,13 @@ export async function display_stacktrace(ex: Error): Promise<void> {
}; };
}), }),
); );
let more_info: string | undefined;
if (ex instanceof BlueslipError) {
more_info = JSON.stringify(ex.more_info, null, 4);
}
errors.push({ errors.push({
message: exception_msg(ex), message: exception_msg(ex),
more_info,
stackframes, stackframes,
}); });

View File

@ -77,6 +77,16 @@ $alert-error-red: hsl(0deg 80% 40%);
} }
} }
.stacktrace-more-info {
font-size: 0.85rem;
white-space: pre;
font-family: "Source Code Pro", monospace;
margin-left: 3.3rem;
margin-bottom: 0.5rem;
padding: 0.5rem;
background-color: hsl(0deg 7% 98%);
}
.stacktrace-content { .stacktrace-content {
font-family: "Source Code Pro", monospace; font-family: "Source Code Pro", monospace;
font-size: 0.85rem; font-size: 0.85rem;

View File

@ -1218,6 +1218,10 @@
color: hsl(314deg 19% 63%); color: hsl(314deg 19% 63%);
} }
.stacktrace-more-info {
background-color: hsl(312deg 7% 14%);
}
.code-context { .code-context {
color: hsl(314deg 27% 82%); color: hsl(314deg 27% 82%);
background-color: hsl(312deg 7% 14%); background-color: hsl(312deg 7% 14%);

View File

@ -8,6 +8,9 @@
<div class="exit"></div> <div class="exit"></div>
{{/if}} {{/if}}
</div> </div>
{{#if more_info}}
<div class="stacktrace-more-info">{{more_info}}</div>
{{/if}}
<div class="stacktrace-content"> <div class="stacktrace-content">
{{#each stackframes}} {{#each stackframes}}
<div data-full-path="{{ full_path }}" data-line-no="{{ line_number }}"> <div data-full-path="{{ full_path }}" data-line-no="{{ line_number }}">