fixes not handled exception in "task_mesh_gmsh.py"

error = sys.exc_info()[0].strip()
<class 'AttributeError'>: type object 'RuntimeError' has no attribute 'strip'
Furthermore reporting "value" instead of "type" gives more useful error messages
This commit is contained in:
UR-0
2021-03-05 08:14:37 +01:00
committed by Bernd Hahnebach
parent 41de6c3d99
commit 0274b039a2
2 changed files with 3 additions and 3 deletions

View File

@@ -203,11 +203,11 @@ class _TaskPanel:
error = gmsh_mesh.create_mesh()
except Exception:
import sys
error = sys.exc_info()[1]
FreeCAD.Console.PrintMessage(
"Unexpected error when creating mesh: {}\n"
.format(sys.exc_info()[0])
.format(error)
)
error = sys.exc_info()[0].strip()
if error:
FreeCAD.Console.PrintMessage("Gmsh had warnings ...\n")
FreeCAD.Console.PrintMessage("{}\n".format(error))

View File

@@ -380,7 +380,7 @@ class FemToolsCcx(QtCore.QRunnable, QtCore.QObject):
except Exception:
FreeCAD.Console.PrintError(
"Unexpected error when writing CalculiX input file: {}\n"
.format(sys.exc_info()[0])
.format(sys.exc_info()[1])
)
raise