From feb5d9b74fa1e8454eaaf29afae3643c6d7c81f1 Mon Sep 17 00:00:00 2001 From: Andrew Godwin Date: Fri, 11 Nov 2022 22:02:43 -0700 Subject: Got up to incoming posts working --- stator/models.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'stator') diff --git a/stator/models.py b/stator/models.py index 072a3ed..98efce6 100644 --- a/stator/models.py +++ b/stator/models.py @@ -1,4 +1,5 @@ import datetime +import pprint import traceback from typing import ClassVar, List, Optional, Type, Union, cast @@ -218,10 +219,16 @@ class StatorError(models.Model): instance: StatorModel, exception: Optional[BaseException] = None, ): + detail = traceback.format_exc() + if exception and len(exception.args) > 1: + detail += "\n\n" + "\n\n".join( + pprint.pformat(arg) for arg in exception.args + ) + return await cls.objects.acreate( model_label=instance._meta.label_lower, instance_pk=str(instance.pk), state=instance.state, error=str(exception), - error_details=traceback.format_exc(), + error_details=detail, ) -- cgit v1.2.3