Skip to content

Commit cbefee6

Browse files
authored
FIX: raise Error if fail to craete terminal (#749)
Co-authored-by: ring630 <@gmail.com>
1 parent 49d336b commit cbefee6

File tree

3 files changed

+21
-4
lines changed

3 files changed

+21
-4
lines changed

src/pyedb/dotnet/edb_core/cell/terminal/padstack_instance_terminal.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,13 @@ def create(self, padstack_instance, name=None, layer=None, is_ref=False):
8484
isRef=is_ref,
8585
)
8686
terminal = PadstackInstanceTerminal(self._pedb, terminal)
87-
88-
return terminal if not terminal.is_null else False
87+
if terminal.is_null:
88+
msg = f"Failed to create terminal. "
89+
if name in self._pedb.terminals:
90+
msg += f"Terminal {name} already exists."
91+
raise Exception(msg)
92+
else:
93+
return terminal
8994

9095
def _get_parameters(self):
9196
"""Gets the parameters of the padstack instance terminal."""

src/pyedb/dotnet/edb_core/cell/terminal/pingroup_terminal.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,13 @@ def create(self, name, net_name, pin_group_name, is_ref=False):
5656
is_ref,
5757
)
5858
term = PinGroupTerminal(self._pedb, term)
59-
return term if not term.is_null else False
59+
if term.is_null:
60+
msg = f"Failed to create terminal. "
61+
if name in self._pedb.terminals:
62+
msg += f"Terminal {name} already exists."
63+
raise Exception(msg)
64+
else:
65+
return term
6066

6167
def pin_group(self):
6268
"""Gets the pin group the terminal refers to."""

src/pyedb/dotnet/edb_core/cell/terminal/point_terminal.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,4 +59,10 @@ def create(self, name, net, location, layer, is_ref=False):
5959
is_ref,
6060
)
6161
terminal = PointTerminal(self._pedb, terminal)
62-
return terminal if not terminal.is_null else False
62+
if terminal.is_null:
63+
msg = f"Failed to create terminal. "
64+
if name in self._pedb.terminals:
65+
msg += f"Terminal {name} already exists."
66+
raise Exception(msg)
67+
else:
68+
return terminal

0 commit comments

Comments
 (0)