diff options
author | Andrew Godwin | 2022-11-11 22:02:43 -0700 |
---|---|---|
committer | Andrew Godwin | 2022-11-11 22:02:43 -0700 |
commit | feb5d9b74fa1e8454eaaf29afae3643c6d7c81f1 (patch) | |
tree | 3889a826dfc2c852aa4873daff2a27cb7c1a2b01 /stator | |
parent | fbfad9fbf5e061cb7c658dada3c4014c9796021c (diff) | |
download | takahe-feb5d9b74fa1e8454eaaf29afae3643c6d7c81f1.tar.gz takahe-feb5d9b74fa1e8454eaaf29afae3643c6d7c81f1.tar.bz2 takahe-feb5d9b74fa1e8454eaaf29afae3643c6d7c81f1.zip |
Got up to incoming posts working
Diffstat (limited to 'stator')
-rw-r--r-- | stator/models.py | 9 |
1 files changed, 8 insertions, 1 deletions
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, ) |