I want to learn TypeScript.
I have a JSON dictionary returned by the sentry method event_from_exception() (Python).
I would like to format it as nice HTML with expandable local variables and pre_ and post_context. The result should look roughly like this:
Here is an example json:
{
"exception": {
"values": [
{
"stacktrace": {
"frames": [
{
"function": "main",
"abs_path": "/home/modlink_cok_d/src/sentry-json.py",
"pre_context": [
"from sentry_sdk.utils import event_from_exception",
"",
"def main():",
" local_var = 1",
" try:"
],
"lineno": 9,
"vars": {
"exc": "ValueError()",
"local_var": "1"
},
"context_line": " raise ValueError()",
"post_context": [
" except Exception as exc:",
" event, info = event_from_exception(sys.exc_info(), with_locals=True)",
" print(json.dumps(event, indent=2))",
"",
"main()"
],
"module": "__main__",
"filename": "sentry-json.py"
}
]
},
"type": "ValueError",
"value": "",
"module": "exceptions",
"mechanism": null
}
]
},
"level": "error"
}
How could this be done with TypeScript?
from Convert JSON (from Sentry) to HTML with TypeScript

No comments:
Post a Comment