Skip to content

Commit 7dffdfd

Browse files
Copilottwlite
andauthored
fix: warn and skip invalid event handlers
* Initial plan * Add warning log with file path for missing event handler function Co-authored-by: twlite <46562212+twlite@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: twlite <46562212+twlite@users.noreply.github.com>
1 parent 53dbcca commit 7dffdfd

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

packages/commandkit/src/app/handlers/AppEventsHandler.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,8 @@ export class AppEventsHandler {
106106
const handler = await import(toFileURL(listener, true));
107107

108108
if (!handler.default || typeof handler.default !== 'function') {
109-
Logger.error`Event handler for ${event.event}${event.namespace ? ` of namespace ${event.namespace}` : ''} does not have a default export or is not a function`;
109+
Logger.warn`Event handler for ${event.event}${event.namespace ? ` of namespace ${event.namespace}` : ''} at "${listener}" does not have a default export or is not a function. Skipping...`;
110+
continue;
110111
}
111112

112113
listeners.push({

0 commit comments

Comments
 (0)