From 7e5782a2924e7b32b29a016942de8f147ab24f6a Mon Sep 17 00:00:00 2001 From: Johannes Nussbaum Date: Fri, 13 Oct 2023 18:45:41 +0200 Subject: [PATCH] ApiError needs __str__() with pprint, albeit it is a dataclass :-( --- dsp_permissions_scripts/models/api_error.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/dsp_permissions_scripts/models/api_error.py b/dsp_permissions_scripts/models/api_error.py index ed9003c4..a5faf4bf 100644 --- a/dsp_permissions_scripts/models/api_error.py +++ b/dsp_permissions_scripts/models/api_error.py @@ -1,3 +1,4 @@ +import pprint from dataclasses import dataclass, field from typing import Any @@ -10,3 +11,6 @@ class ApiError(Exception): response_text: str | None = None status_code: int | None = None payload: dict[str, Any] = field(default_factory=dict) + + def __str__(self) -> str: + return pprint.pformat(vars(self))