Skip to content

Commit

Permalink
Error message title (#3041)
Browse files Browse the repository at this point in the history
  • Loading branch information
fonsp authored Oct 3, 2024
1 parent 819b452 commit ef2348f
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
19 changes: 18 additions & 1 deletion frontend/components/ErrorMessage.js
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,11 @@ const frame_is_important_heuristic = (frame, frame_index, limited_stacktrace, fr
return false
}

if (funcname.includes("throw")) return false

// too sciency
if (frame.inlined) return false

if (params == null) {
// no type signature... must be some function call that got optimized away or something special
// probably not directly relevant
Expand Down Expand Up @@ -419,9 +424,11 @@ export const ErrorMessage = ({ msg, stacktrace, cell_id }) => {
(frame) => !(ignore_location(frame) && ignore_funccall(frame))
)

const first_package = get_first_package(limited_stacktrace)

return html`<jlerror>
<div class="error-header">
<secret-h1>Error message</secret-h1>
<secret-h1>Error message${first_package == null ? null : ` from ${first_package}`}</secret-h1>
<!-- <p>This message was included with the error:</p> -->
</div>
Expand Down Expand Up @@ -470,6 +477,16 @@ export const ErrorMessage = ({ msg, stacktrace, cell_id }) => {
</jlerror>`
}

const get_first_package = (limited_stacktrace) => {
for (let [i, frame] of limited_stacktrace.entries()) {
const frame_cell_id = extract_cell_id(frame.file)
if (frame_cell_id) return undefined

const important = frame_is_important_heuristic(frame, i, limited_stacktrace, frame_cell_id)
if (!important) continue

if (frame.source_package) return frame.source_package
}
const motivational_words = [
//
"Don't panic!",
Expand Down
4 changes: 4 additions & 0 deletions frontend/treeview.css
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,10 @@ jlerror > section > ol > li {
jlerror > section > ol > li:not(.important):not(:hover) {
opacity: 0.5;
}

jlerror > section > ol > li:not(.important)::marker {
font-weight: 100;
}
jlerror > section > ol > li.from_this_notebook {
--bg: var(--jl-info-acccolor);
background: var(--bg);
Expand Down

0 comments on commit ef2348f

Please sign in to comment.