Skip to content

Commit aa329ea

Browse files
feat(ui): handle enriched events
1 parent 1e622a5 commit aa329ea

File tree

4 files changed

+23
-7
lines changed

4 files changed

+23
-7
lines changed

invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/socketio/socketInvocationError.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,21 @@ export const addInvocationErrorEventListener = (startAppListening: AppStartListe
3939
actionCreator: socketInvocationError,
4040
effect: (action, { getState }) => {
4141
log.error(action.payload, `Invocation error (${action.payload.data.node.type})`);
42-
const { source_node_id, error_type, graph_execution_state_id } = action.payload.data;
42+
const { source_node_id, error_type, error_message, error_traceback, graph_execution_state_id } =
43+
action.payload.data;
4344
const nes = deepClone($nodeExecutionStates.get()[source_node_id]);
4445
if (nes) {
4546
nes.status = zNodeStatus.enum.FAILED;
46-
nes.error = action.payload.data.error;
4747
nes.progress = null;
4848
nes.progressImage = null;
49+
50+
if (error_type && error_message && error_traceback) {
51+
nes.error = {
52+
error_type,
53+
error_message,
54+
error_traceback,
55+
};
56+
}
4957
upsertExecutionState(nes.nodeId, nes);
5058
}
5159

invokeai/frontend/web/src/features/nodes/types/invocation.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,18 @@ export const isInvocationNodeData = (node?: AnyNodeData | null): node is Invocat
7070

7171
// #region NodeExecutionState
7272
export const zNodeStatus = z.enum(['PENDING', 'IN_PROGRESS', 'COMPLETED', 'FAILED']);
73+
const zNodeError = z.object({
74+
error_type: z.string(),
75+
error_message: z.string(),
76+
error_traceback: z.string(),
77+
});
7378
const zNodeExecutionState = z.object({
7479
nodeId: z.string().trim().min(1),
7580
status: zNodeStatus,
7681
progress: z.number().nullable(),
7782
progressImage: zProgressImage.nullable(),
78-
error: z.string().nullable(),
7983
outputs: z.array(z.any()),
84+
error: zNodeError.nullable(),
8085
});
8186
export type NodeExecutionState = z.infer<typeof zNodeExecutionState>;
8287
// #endregion

invokeai/frontend/web/src/features/queue/components/QueueList/QueueItemDetail.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ const QueueItemComponent = ({ queueItemDTO }: Props) => {
7676
</Button>
7777
</ButtonGroup>
7878
</Flex>
79-
{queueItem?.error && (
79+
{(queueItem?.error_traceback || queueItem?.error_message) && (
8080
<Flex
8181
layerStyle="second"
8282
p={3}
@@ -89,7 +89,7 @@ const QueueItemComponent = ({ queueItemDTO }: Props) => {
8989
<Heading size="sm" color="error.400">
9090
{t('common.error')}
9191
</Heading>
92-
<pre>{queueItem.error}</pre>
92+
<pre>{queueItem?.error_traceback ?? queueItem?.error_message}</pre>
9393
</Flex>
9494
)}
9595
<Flex layerStyle="second" h={512} w="full" borderRadius="base" alignItems="center" justifyContent="center">

invokeai/frontend/web/src/services/events/types.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,8 @@ export type InvocationErrorEvent = {
116116
node: BaseNode;
117117
source_node_id: string;
118118
error_type: string;
119-
error: string;
119+
error_message: string;
120+
error_traceback: string;
120121
};
121122

122123
/**
@@ -187,7 +188,9 @@ export type QueueItemStatusChangedEvent = {
187188
batch_id: string;
188189
session_id: string;
189190
status: components['schemas']['SessionQueueItemDTO']['status'];
190-
error: string | undefined;
191+
error_type?: string | null;
192+
error_message?: string | null;
193+
error_traceback?: string | null;
191194
created_at: string;
192195
updated_at: string;
193196
started_at: string | undefined;

0 commit comments

Comments
 (0)