mirror of https://github.com/Desuuuu/klipper.git
webhooks: Fix use of deprecated Exception.message attribute (#3781)
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 <m431.kerbiriou@gmail.com>
This commit is contained in:
parent
64097cb0d0
commit
9278f56e36
|
@ -530,7 +530,7 @@ class BedMeshCalibrate:
|
||||||
try:
|
try:
|
||||||
z_mesh.build_mesh(probed_matrix)
|
z_mesh.build_mesh(probed_matrix)
|
||||||
except BedMeshError as e:
|
except BedMeshError as e:
|
||||||
raise self.gcode.error(e.message)
|
raise self.gcode.error(str(e))
|
||||||
self.bedmesh.set_mesh(z_mesh)
|
self.bedmesh.set_mesh(z_mesh)
|
||||||
self.gcode.respond_info("Mesh Bed Leveling Complete")
|
self.gcode.respond_info("Mesh Bed Leveling Complete")
|
||||||
self.bedmesh.save_profile("default")
|
self.bedmesh.save_profile("default")
|
||||||
|
@ -988,7 +988,7 @@ class ProfileManager:
|
||||||
try:
|
try:
|
||||||
z_mesh.build_mesh(probed_matrix)
|
z_mesh.build_mesh(probed_matrix)
|
||||||
except BedMeshError as e:
|
except BedMeshError as e:
|
||||||
raise self.gcode.error(e.message)
|
raise self.gcode.error(str(e))
|
||||||
self.current_profile = prof_name
|
self.current_profile = prof_name
|
||||||
self.bedmesh.set_mesh(z_mesh)
|
self.bedmesh.set_mesh(z_mesh)
|
||||||
def remove_profile(self, prof_name):
|
def remove_profile(self, prof_name):
|
||||||
|
|
|
@ -29,7 +29,7 @@ class WebRequestError(gcode.CommandError):
|
||||||
def to_dict(self):
|
def to_dict(self):
|
||||||
return {
|
return {
|
||||||
'error': 'WebRequestError',
|
'error': 'WebRequestError',
|
||||||
'message': self.message}
|
'message': str(self)}
|
||||||
|
|
||||||
class Sentinel:
|
class Sentinel:
|
||||||
pass
|
pass
|
||||||
|
@ -224,12 +224,12 @@ class ClientConnection:
|
||||||
func = self.webhooks.get_callback(web_request.get_method())
|
func = self.webhooks.get_callback(web_request.get_method())
|
||||||
func(web_request)
|
func(web_request)
|
||||||
except self.printer.command_error as e:
|
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:
|
except Exception as e:
|
||||||
msg = ("Internal Error on WebRequest: %s"
|
msg = ("Internal Error on WebRequest: %s"
|
||||||
% (web_request.get_method()))
|
% (web_request.get_method()))
|
||||||
logging.exception(msg)
|
logging.exception(msg)
|
||||||
web_request.set_error(WebRequestError(e.message))
|
web_request.set_error(WebRequestError(str(e)))
|
||||||
self.printer.invoke_shutdown(msg)
|
self.printer.invoke_shutdown(msg)
|
||||||
result = web_request.finish()
|
result = web_request.finish()
|
||||||
if result is None:
|
if result is None:
|
||||||
|
|
Loading…
Reference in New Issue