Remove logger.exception from outside try except statement

logger.exception should only be used inside a try except statement where
there is some error/stacktrace that needs outputting as well as the
error message. Instead, should use logger.error then raise an error,
and/or pass the message to the error being raised (which the calling
function should handle and/or log the exception).
这个提交包含在:
nmannall
2025-02-13 11:31:30 +00:00
父节点 ebfdb22725
当前提交 df568f0fd2

查看文件

@@ -98,16 +98,14 @@ class Plate(RotatableMixin, GeometryUserObject):
or (zs == zf and (xs == xf or ys == yf))
or (xs != xf and ys != yf and zs != zf)
):
logger.exception(f"{self.__str__()} the plate is not specified correctly")
raise ValueError
raise ValueError(f"{self.__str__()} the plate is not specified correctly")
# Look up requested materials in existing list of material instances
materials = [y for x in materialsrequested for y in grid.materials if y.ID == x]
if len(materials) != len(materialsrequested):
notfound = [x for x in materialsrequested if x not in materials]
logger.exception(f"{self.__str__()} material(s) {notfound} do not exist")
raise ValueError
raise ValueError(f"{self.__str__()} material(s) {notfound} do not exist")
# yz-plane plate
if xs == xf: