From 9278f56e3685a71eea6f2ae393a7e4f32b048420 Mon Sep 17 00:00:00 2001 From: Maël Kerbiriou Date: Mon, 18 Jan 2021 04:37:41 +0100 Subject: webhooks: Fix use of deprecated Exception.message attribute (#3781) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since Python 2.6, the BaseException.message attribute is deprecated (PEP-352[1]) in favor of e.args[0] or str(e). This commit replaces e.message with str(e). [1] https://www.python.org/dev/peps/pep-0352/ Signed-off-by: Maël Kerbiriou --- klippy/webhooks.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'klippy/webhooks.py') diff --git a/klippy/webhooks.py b/klippy/webhooks.py index 7fffc1fe..2deed429 100644 --- a/klippy/webhooks.py +++ b/klippy/webhooks.py @@ -29,7 +29,7 @@ class WebRequestError(gcode.CommandError): def to_dict(self): return { 'error': 'WebRequestError', - 'message': self.message} + 'message': str(self)} class Sentinel: pass @@ -224,12 +224,12 @@ class ClientConnection: func = self.webhooks.get_callback(web_request.get_method()) func(web_request) except self.printer.command_error as e: - web_request.set_error(WebRequestError(e.message)) + web_request.set_error(WebRequestError(str(e))) except Exception as e: msg = ("Internal Error on WebRequest: %s" % (web_request.get_method())) logging.exception(msg) - web_request.set_error(WebRequestError(e.message)) + web_request.set_error(WebRequestError(str(e))) self.printer.invoke_shutdown(msg) result = web_request.finish() if result is None: -- cgit v1.2.3-70-g09d2