Skip to content

Commit 096fe63

Browse files
committed
fix: dpf server error handling optimize
1 parent ace473a commit 096fe63

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

src/ansys/dpf/gate/errors.py

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,12 @@ class DPFServerException(Exception):
55
"""Error raised when the DPF server has encountered an error."""
66

77
def __init__(self, msg=""):
8-
parties = [p.strip() for p in msg.split('<-')]
9-
10-
if len(parties) >= 2:
11-
explicit = parties[-1]
12-
entities = parties[:-1]
13-
result = "<-".join(entities)
14-
else:
15-
explicit = msg.strip()
16-
result = ""
17-
18-
Exception.__init__(self, explicit)
19-
self.add_note(result)
8+
parts = msg.rsplit('<-', maxsplit=1)
9+
error_message = parts[1]
10+
error_note = parts[0]
11+
12+
Exception.__init__(self, error_message)
13+
self.add_note(error_note)
2014

2115

2216
class DPFServerNullObject(Exception):

0 commit comments

Comments
 (0)