Skip to content

Commit a0bc48a

Browse files
tidy(nodes): code dedupe for batch node init errors
1 parent b3e743f commit a0bc48a

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

invokeai/app/invocations/batch.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,13 @@
2323
]
2424

2525

26+
class NotExecutableNodeError(Exception):
27+
def __init__(self, message: str = "This class should never be executed or instantiated directly."):
28+
super().__init__(message)
29+
30+
pass
31+
32+
2633
class BaseBatchInvocation(BaseInvocation):
2734
batch_group_id: BATCH_GROUP_IDS = InputField(
2835
default="None",
@@ -32,7 +39,7 @@ class BaseBatchInvocation(BaseInvocation):
3239
)
3340

3441
def __init__(self):
35-
raise NotImplementedError("This class should never be executed or instantiated directly.")
42+
raise NotExecutableNodeError()
3643

3744

3845
@invocation(
@@ -51,7 +58,7 @@ class ImageBatchInvocation(BaseBatchInvocation):
5158
)
5259

5360
def invoke(self, context: InvocationContext) -> ImageOutput:
54-
raise NotImplementedError("This class should never be executed or instantiated directly.")
61+
raise NotExecutableNodeError()
5562

5663

5764
@invocation(
@@ -70,7 +77,7 @@ class StringBatchInvocation(BaseBatchInvocation):
7077
)
7178

7279
def invoke(self, context: InvocationContext) -> StringOutput:
73-
raise NotImplementedError("This class should never be executed or instantiated directly.")
80+
raise NotExecutableNodeError()
7481

7582

7683
@invocation(
@@ -89,7 +96,7 @@ class IntegerBatchInvocation(BaseBatchInvocation):
8996
)
9097

9198
def invoke(self, context: InvocationContext) -> IntegerOutput:
92-
raise NotImplementedError("This class should never be executed or instantiated directly.")
99+
raise NotExecutableNodeError()
93100

94101

95102
@invocation(
@@ -108,4 +115,4 @@ class FloatBatchInvocation(BaseBatchInvocation):
108115
)
109116

110117
def invoke(self, context: InvocationContext) -> FloatOutput:
111-
raise NotImplementedError("This class should never be executed or instantiated directly.")
118+
raise NotExecutableNodeError()

0 commit comments

Comments
 (0)