Skip to content

Commit ace473a

Browse files
committed
feat: improve server errors handling
1 parent f5591a4 commit ace473a

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

src/ansys/dpf/gate/errors.py

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

77
def __init__(self, msg=""):
8-
Exception.__init__(self, msg)
9-
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)
20+
1021

1122
class DPFServerNullObject(Exception):
1223
"""Error raised when the DPF server cannot find an object."""

0 commit comments

Comments
 (0)