Skip to content

Commit 62205ce

Browse files
authored
Merge pull request real-easypy#10 from kendriu/vast
Multiexception/add_details: Parse timestamp only if it is in parsable type
2 parents ad9227c + d2c122f commit 62205ce

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

easypy/concurrency.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,10 @@ def _format_context(context):
303303

304304
def add_details(exc):
305305
if kw.get("timestamp", True) and getattr(exc, "timestamp", None):
306-
ts = datetime.fromtimestamp(exc.timestamp).isoformat()
306+
if isinstance(exc.timestamp, (int, float)):
307+
ts = datetime.fromtimestamp(exc.timestamp).isoformat()
308+
else:
309+
ts = exc.timestamp
307310
buff.write(normalize_color("MAGENTA<<Timestamp: %s>>" % ts))
308311
if kw.get("context", True) and getattr(exc, "context", None):
309312
buff.write("Context: %s" % _format_context(exc.context))

0 commit comments

Comments
 (0)