Py3: more fix "err has no attribute message"
This commit is contained in:
parent
760a2c1af9
commit
c6c1828c15
|
@ -214,7 +214,7 @@ class _ViewProviderCompoundFilter:
|
|||
if self.Object.Stencil:
|
||||
self.Object.Stencil.ViewObject.show()
|
||||
except Exception as err:
|
||||
App.Console.PrintError("Error in onDelete: " + err.message)
|
||||
App.Console.PrintError("Error in onDelete: " + str(err))
|
||||
return True
|
||||
|
||||
def CreateCompoundFilter(name):
|
||||
|
|
|
@ -95,7 +95,7 @@ class _ViewProviderFuseCompound:
|
|||
try:
|
||||
screen(self.Object.Base).ViewObject.show()
|
||||
except Exception as err:
|
||||
FreeCAD.Console.PrintError("Error in onDelete: " + err.message)
|
||||
FreeCAD.Console.PrintError("Error in onDelete: " + str(err))
|
||||
return True
|
||||
|
||||
# -------------------------- /document object --------------------------------------------------
|
||||
|
|
|
@ -290,7 +290,7 @@ class ViewProviderLatticeFeature:
|
|||
child.ViewObject.show()
|
||||
except Exception as err:
|
||||
# catch all exceptions, because we don't want to prevent deletion if something goes wrong
|
||||
FreeCAD.Console.PrintError("Error in onDelete: " + err.message)
|
||||
FreeCAD.Console.PrintError("Error in onDelete: " + str(err))
|
||||
return True
|
||||
|
||||
|
||||
|
|
|
@ -168,7 +168,7 @@ class _ViewProviderLatticeDowngrade:
|
|||
try:
|
||||
screen(self.Object.Base).ViewObject.show()
|
||||
except Exception as err:
|
||||
FreeCAD.Console.PrintError("Error in onDelete: " + err.message)
|
||||
FreeCAD.Console.PrintError("Error in onDelete: " + str(err))
|
||||
return True
|
||||
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ def executeFeature(obj):
|
|||
raise
|
||||
except Exception as err:
|
||||
try:
|
||||
error(obj,err.message)
|
||||
error(obj,str(err))
|
||||
except CancelError:
|
||||
obj.Document.abortTransaction()
|
||||
raise
|
||||
|
@ -97,4 +97,5 @@ def _showMsg(obj, message, forceMessage, _type):
|
|||
class CancelError(Exception):
|
||||
def __init__(self):
|
||||
self.message = "Canceled by user"
|
||||
self.args = (self.message,)
|
||||
self.isCancelError = True
|
|
@ -90,10 +90,8 @@ def cmdExposeLinkSubs():
|
|||
ExposeLinkSub(obj, propname)
|
||||
cnt += 1
|
||||
except Exception as err:
|
||||
Executer.warning(None,"Attempting to expose sublink property %prop of %feat caused an error:\n%err"
|
||||
.replace("%prop",propname)
|
||||
.replace("%feat",obj.Name)
|
||||
.replace("%err",err.message) )
|
||||
Executer.warning(None,"Attempting to expose sublink property {prop} of {feat} caused an error:\n{err}"
|
||||
.format(prop= propname, feat= obj.Name, err= str(err)) )
|
||||
if cnt == 0:
|
||||
raise ValueError("No links to expose were found.")
|
||||
except Exception:
|
||||
|
|
|
@ -70,7 +70,7 @@ def loadShape(shapeID):
|
|||
sh = sh.childShapes()[0]
|
||||
f.close()
|
||||
except Exception as err:
|
||||
FreeCAD.Console.PrintError('Failed to load standard shape "'+shapeID+'". \n' + err.message + '\n')
|
||||
FreeCAD.Console.PrintError('Failed to load standard shape "'+shapeID+'". \n' + str(err) + '\n')
|
||||
sh = Part.Point() #Create at least something!
|
||||
_ShapeDict[shapeID] = sh
|
||||
return sh
|
||||
|
|
|
@ -147,7 +147,7 @@ class LatticeParaSeries(lattice2BaseFeature.LatticeFeature):
|
|||
App.Console.PrintError("{obj}: failed to read out parameter '{param}': {err}\n"
|
||||
.format(obj= selfobj.Name,
|
||||
param= refstr,
|
||||
err= err.message))
|
||||
err= str(err)))
|
||||
defvalues.append(val)
|
||||
N_params = len(defvalues)
|
||||
if N_params == 0:
|
||||
|
|
|
@ -132,7 +132,7 @@ class ViewProviderLatticeSlice:
|
|||
screen(self.Object.Base).ViewObject.show()
|
||||
screen(self.Object.Tool).ViewObject.show()
|
||||
except Exception as err:
|
||||
FreeCAD.Console.PrintError("Error in onDelete: " + err.message)
|
||||
FreeCAD.Console.PrintError("Error in onDelete: " + str(err))
|
||||
return True
|
||||
|
||||
# -------------------------- /document object --------------------------------------------------
|
||||
|
|
|
@ -106,7 +106,7 @@ class CommandSubstituteObject:
|
|||
mb = QtGui.QMessageBox()
|
||||
mb.setIcon(mb.Icon.Warning)
|
||||
mb.setText(translate("Lattice2_SubstituteObject", "An error occured while substituting object:", None)+ u"\n"
|
||||
+ unicode(err.message))
|
||||
+ str(err))
|
||||
mb.setWindowTitle(translate("Lattice2_SubstituteObject","Error", None))
|
||||
mb.exec_()
|
||||
App.ActiveDocument.abortTransaction()
|
||||
|
@ -119,7 +119,7 @@ class CommandSubstituteObject:
|
|||
sel[0].Object.ViewObject.Visibility = True
|
||||
sel[1].Object.ViewObject.Visibility = old_was_visible
|
||||
except Exception as err:
|
||||
App.Console.PrintError("SubstituteFeature: error when changing visibilities: "+err.message+"\n")
|
||||
App.Console.PrintError("SubstituteFeature: error when changing visibilities: "+str(err)+"\n")
|
||||
else:
|
||||
mb = QtGui.QMessageBox()
|
||||
mb.setIcon(mb.Icon.Warning)
|
||||
|
|
Loading…
Reference in New Issue
Block a user