Skip to content

Commit ed7eb3c

Browse files
fix(app): fix logging of error classes instead of class names
1 parent 48bbc46 commit ed7eb3c

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

invokeai/app/services/session_processor/session_processor_default.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -127,11 +127,9 @@ def run_node(self, invocation: BaseInvocation, queue_item: SessionQueueItem):
127127
pass
128128
except Exception as e:
129129
# Must extract the exception traceback here to not lose its stacktrace when we change scope
130-
exc_type = type(e)
131-
exc_value = e
132130
exc_traceback = e.__traceback__
133131
assert exc_traceback is not None
134-
self._on_node_error(invocation, queue_item, exc_type, exc_value, exc_traceback)
132+
self._on_node_error(invocation, queue_item, type(e), e, exc_traceback)
135133

136134
def _on_before_run_session(self, queue_item: SessionQueueItem) -> None:
137135
# If profiling is enabled, start the profiler
@@ -212,7 +210,7 @@ def _on_node_error(
212210

213211
queue_item.session.set_node_error(invocation.id, stacktrace)
214212
self._services.logger.error(
215-
f"Error while invoking session {queue_item.session_id}, invocation {invocation.id} ({invocation.get_type()}):\n{exc_type}"
213+
f"Error while invoking session {queue_item.session_id}, invocation {invocation.id} ({invocation.get_type()}): {exc_type.__name__}"
216214
)
217215
self._services.logger.error(stacktrace)
218216

@@ -374,11 +372,9 @@ def _process(
374372

375373
except Exception as e:
376374
# Must extract the exception traceback here to not lose its stacktrace when we change scope
377-
exc_type = type(e)
378-
exc_value = e
379375
exc_traceback = e.__traceback__
380376
assert exc_traceback is not None
381-
self._on_non_fatal_processor_error(self._queue_item, exc_type, exc_value, exc_traceback)
377+
self._on_non_fatal_processor_error(self._queue_item, type(e), e, exc_traceback)
382378
# Immediately poll for next queue item
383379
poll_now_event.wait(self._polling_interval)
384380
continue
@@ -401,7 +397,8 @@ def _on_non_fatal_processor_error(
401397
) -> None:
402398
stacktrace = get_stacktrace(exc_type, exc_value, exc_traceback)
403399
# Non-fatal error in processor
404-
self._invoker.services.logger.error(f"Non-fatal error in session processor:\n{stacktrace}")
400+
self._invoker.services.logger.error(f"Non-fatal error in session processor: {exc_type.__name__}")
401+
self._invoker.services.logger.error(stacktrace)
405402
# Cancel the queue item
406403
if queue_item is not None:
407404
self._invoker.services.session_queue.cancel_queue_item(queue_item.item_id, error=stacktrace)

0 commit comments

Comments
 (0)