openreplay/api/chalicelib/utils/errors_helper.py
Kraiem Taha Yassine 4c4e1b6580
Dev (#2905)
* feat(chalice): autocomplete return top 10 with stats

* fix(chalice): fixed autocomplete top 10 meta-filters

* refactor(chalice): pg client helper handles closed connexion

* refactor(chalice): upgraded dependencies
refactor(chalice): restricted get error's details
2024-12-23 17:19:43 +01:00

14 lines
544 B
Python

from chalicelib.core.sourcemaps import sourcemaps
def format_first_stack_frame(error):
error["stack"] = sourcemaps.format_payload(error.pop("payload"), truncate_to_first=True)
for s in error["stack"]:
for c in s.get("context", []):
for sci, sc in enumerate(c):
if isinstance(sc, str) and len(sc) > 1000:
c[sci] = sc[:1000]
# convert bytes to string:
if isinstance(s["filename"], bytes):
s["filename"] = s["filename"].decode("utf-8")
return error