Debug IDs for missing sourcemaps: show them right in the stacktrace

See #158
This commit is contained in:
Klaas van Schelven
2025-07-23 10:57:19 +02:00
parent 1983633b38
commit c4fe1c1292
2 changed files with 11 additions and 1 deletions

View File

@@ -167,6 +167,12 @@ def apply_sourcemaps(event_data):
frame['function'] = token.name
# frame["colno"] = token.src_col + TO_DISPLAY not actually used
elif frame.get("filename") in debug_id_for_filename:
# The event_data reports that a debug_id is available for this filename, but we don't have it; this
# could be because the sourcemap was not uploaded. We want to show the debug_id in the stacktrace as
# a hint to the user that they should upload the sourcemap.
frame["debug_id"] = str(debug_id_for_filename[frame["filename"]])
def get_sourcemap_images(event_data):
# NOTE: butchered copy/paste of apply_sourcemaps; refactoring for DRY is a TODO

View File

@@ -146,7 +146,11 @@
{% if "context_line" not in frame or frame.context_line is None %}{% if not frame.vars %}{# nested ifs as a subsitute for brackets-in-templates #}
<div class="mt-6 mb-6 italic">
No code context or variables available for this frame.
{% if frame.debug_id %}{# only in the no-vars-either case to avoid excessive if-nesting (at the cost of completeness, but "will yes-vars, broken debug_id even be a case? For now we hope not) #}
No sourcemaps found for Debug ID {{ frame.debug_id }}
{% else %}
No code context or variables available for this frame.
{% endif %}
</div>
{% endif %}{% endif %}