Exception.message => str(Exception)
This commit is contained in:
parent
fb2719ce8a
commit
9b3daeea01
6 changed files with 9 additions and 9 deletions
|
|
@ -305,7 +305,7 @@ class CommandTrigger(GenericEventListener):
|
|||
else:
|
||||
commandExecutioner(command)
|
||||
except subprocess.CalledProcessError, e:
|
||||
self._logger.warn("Command failed with return code %i: %s" % (e.returncode, e.message))
|
||||
self._logger.warn("Command failed with return code %i: %s" % (e.returncode, str(e)))
|
||||
except Exception, ex:
|
||||
self._logger.exception("Command failed")
|
||||
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ class CuraPlugin(octoprint.plugin.SlicerPlugin,
|
|||
try:
|
||||
profile_dict = Profile.from_cura_ini(flask.request.values[input_upload_path])
|
||||
except Exception as e:
|
||||
return flask.make_response("Something went wrong while converting imported profile: {message}".format(e.message), 500)
|
||||
return flask.make_response("Something went wrong while converting imported profile: {message}".format(str(e)), 500)
|
||||
|
||||
elif input_name in flask.request.files:
|
||||
temp_file = tempfile.NamedTemporaryFile("wb", delete=False)
|
||||
|
|
@ -75,7 +75,7 @@ class CuraPlugin(octoprint.plugin.SlicerPlugin,
|
|||
upload.save(temp_file.name)
|
||||
profile_dict = Profile.from_cura_ini(temp_file.name)
|
||||
except Exception as e:
|
||||
return flask.make_response("Something went wrong while converting imported profile: {message}".format(e.message), 500)
|
||||
return flask.make_response("Something went wrong while converting imported profile: {message}".format(str(e)), 500)
|
||||
finally:
|
||||
os.remove(temp_file)
|
||||
|
||||
|
|
|
|||
|
|
@ -310,7 +310,7 @@ class PrinterProfileManager(object):
|
|||
try:
|
||||
yaml.safe_dump(profile, f, default_flow_style=False, indent=" ", allow_unicode=True)
|
||||
except Exception as e:
|
||||
raise SaveError("Cannot save profile %s: %s" % (profile["id"], e.message))
|
||||
raise SaveError("Cannot save profile %s: %s" % (profile["id"], str(e)))
|
||||
|
||||
def _remove_from_path(self, path):
|
||||
try:
|
||||
|
|
|
|||
|
|
@ -135,7 +135,7 @@ def printerToolCommand():
|
|||
try:
|
||||
printer.flow_rate(factor)
|
||||
except ValueError as e:
|
||||
return make_response("Invalid value for flow rate: %s" % e.message, 400)
|
||||
return make_response("Invalid value for flow rate: %s" % str(e), 400)
|
||||
|
||||
return NO_CONTENT
|
||||
|
||||
|
|
@ -273,7 +273,7 @@ def printerPrintheadCommand():
|
|||
try:
|
||||
printer.feed_rate(factor)
|
||||
except ValueError as e:
|
||||
return make_response("Invalid value for feed rate: %s" % e.message, 400)
|
||||
return make_response("Invalid value for feed rate: %s" % str(e), 400)
|
||||
|
||||
return NO_CONTENT
|
||||
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ def printerProfilesAdd():
|
|||
except CouldNotOverwriteError:
|
||||
return make_response("Profile already exists and overwriting was not allowed", 400)
|
||||
except Exception as e:
|
||||
return make_response("Could not save profile: %s" % e.message, 500)
|
||||
return make_response("Could not save profile: %s" % str(e), 500)
|
||||
else:
|
||||
return jsonify(dict(profile=_convert_profile(saved_profile)))
|
||||
|
||||
|
|
@ -118,7 +118,7 @@ def printerProfilesUpdate(identifier):
|
|||
except CouldNotOverwriteError:
|
||||
return make_response("Profile already exists and overwriting was not allowed", 400)
|
||||
except Exception as e:
|
||||
return make_response("Could not save profile: %s" % e.message, 500)
|
||||
return make_response("Could not save profile: %s" % str(e), 500)
|
||||
else:
|
||||
return jsonify(dict(profile=_convert_profile(saved_profile)))
|
||||
|
||||
|
|
|
|||
|
|
@ -141,4 +141,4 @@ class PrinterStateConnection(sockjs.tornado.SockJSConnection, octoprint.printer.
|
|||
try:
|
||||
self.send({type: payload})
|
||||
except Exception as e:
|
||||
self._logger.warn("Could not send message to client %s: %s" % (self._remoteAddress, e.message))
|
||||
self._logger.warn("Could not send message to client %s: %s" % (self._remoteAddress, str(e)))
|
||||
|
|
|
|||
Loading…
Reference in a new issue