From 149137b84dc07aafb1b4fb29fd0c7fc5a8444fe5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Mon, 12 Dec 2022 07:41:16 +0200 Subject: [PATCH] Expose x-error-message header via error_message property for TraktInternalException --- trakt/errors.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/trakt/errors.py b/trakt/errors.py index 9996500b..e8a88371 100644 --- a/trakt/errors.py +++ b/trakt/errors.py @@ -108,6 +108,10 @@ class TraktInternalException(TraktException): http_code = 500 message = 'Internal Server Error' + @property + def error_message(self): + return self.response.headers.get("x-error-message", None) + class TraktBadGateway(TraktException): """TraktException type to be raised when a 502 error is raised"""