From 26872a87c3da660fb16d2edd25e71eb4207e39f8 Mon Sep 17 00:00:00 2001 From: Jason Robinson Date: Mon, 17 Feb 2020 23:54:56 +0200 Subject: [PATCH] More stacktrace in logs when failing to generate a payload --- federation/outbound.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/federation/outbound.py b/federation/outbound.py index e301c61..9956929 100644 --- a/federation/outbound.py +++ b/federation/outbound.py @@ -2,6 +2,7 @@ import copy import importlib import json import logging +import traceback from typing import List, Dict, Union # noinspection PyPackageRequirements @@ -170,10 +171,10 @@ def handle_send( if isinstance(payload.get("object"), dict): payload["object"]["to"] = [fid] rendered_payload = json.dumps(payload).encode("utf-8") - except Exception as ex: - logger.error("handle_send - failed to generate payload for %s, %s: %s", fid, endpoint, ex) - import traceback - logger.error(traceback.format_exc()) + except Exception: + logger.error( + "handle_send - failed to generate payload for %s, %s: %s", fid, endpoint, traceback.format_exc(), + ) continue payloads.append({ "auth": get_http_authentication(author_user.rsa_private_key, f"{author_user.id}#main-key"),