* 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
14 lines
544 B
Python
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
|