From 1769f981da55323ee06317263cf226e02fed0cc1 Mon Sep 17 00:00:00 2001 From: Alex Vandiver Date: Fri, 21 Apr 2023 21:00:59 +0000 Subject: [PATCH] blueslip: Show more-info context in alert popup, if we have it. --- web/src/blueslip_stacktrace.ts | 5 +++++ web/styles/alerts.css | 10 ++++++++++ web/styles/dark_theme.css | 4 ++++ web/templates/blueslip_stacktrace.hbs | 3 +++ 4 files changed, 22 insertions(+) diff --git a/web/src/blueslip_stacktrace.ts b/web/src/blueslip_stacktrace.ts index f355ded492..1767ea6346 100644 --- a/web/src/blueslip_stacktrace.ts +++ b/web/src/blueslip_stacktrace.ts @@ -128,8 +128,13 @@ export async function display_stacktrace(ex: Error): Promise { }; }), ); + let more_info: string | undefined; + if (ex instanceof BlueslipError) { + more_info = JSON.stringify(ex.more_info, null, 4); + } errors.push({ message: exception_msg(ex), + more_info, stackframes, }); diff --git a/web/styles/alerts.css b/web/styles/alerts.css index 920d1e0bd2..c42dbef439 100644 --- a/web/styles/alerts.css +++ b/web/styles/alerts.css @@ -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 { font-family: "Source Code Pro", monospace; font-size: 0.85rem; diff --git a/web/styles/dark_theme.css b/web/styles/dark_theme.css index d7991799b2..5b91de46d0 100644 --- a/web/styles/dark_theme.css +++ b/web/styles/dark_theme.css @@ -1218,6 +1218,10 @@ color: hsl(314deg 19% 63%); } + .stacktrace-more-info { + background-color: hsl(312deg 7% 14%); + } + .code-context { color: hsl(314deg 27% 82%); background-color: hsl(312deg 7% 14%); diff --git a/web/templates/blueslip_stacktrace.hbs b/web/templates/blueslip_stacktrace.hbs index e5cf24b497..04c73c3b41 100644 --- a/web/templates/blueslip_stacktrace.hbs +++ b/web/templates/blueslip_stacktrace.hbs @@ -8,6 +8,9 @@
{{/if}} + {{#if more_info}} +
{{more_info}}
+ {{/if}}
{{#each stackframes}}