Skip to content

fix/undefined activity#31

Merged
allanhvam merged 4 commits into
mainfrom
fix/undefined-activity
Nov 4, 2025
Merged

fix/undefined activity#31
allanhvam merged 4 commits into
mainfrom
fix/undefined-activity

Conversation

@allanhvam
Copy link
Copy Markdown
Owner

No description provided.

@allanhvam allanhvam requested a review from Copilot November 3, 2025 19:50
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds error handling for undefined activities and services in workflow execution, addressing cases where proxy objects are created with invalid targets or where activity functions don't exist.

  • Added validation to prevent proxy creation with non-object targets
  • Added runtime checks for undefined activity functions with descriptive error messages
  • Included comprehensive test coverage for both undefined service and undefined function scenarios

Reviewed Changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated 1 comment.

File Description
src/proxy/proxyActivities.ts Added validation for undefined activities and function existence checks
src/tests/workflow-invalid.test.ts New test file covering undefined service and function error scenarios
src/tests/workflow-throws.test.ts Removed debug console.dir statement from existing test
package.json Version bump from 0.5.3 to 0.5.4

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/proxy/proxyActivities.ts Outdated

const f = activities[activityType];
if (!f) {
throw new Error(`simple-workflows: ${typeof activities}.${activityType} is not a function`);
Copy link

Copilot AI Nov 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error message uses typeof activities which will always be 'object' for objects, making the message unclear. Consider using activities.constructor.name or a more descriptive identifier.

Suggested change
throw new Error(`simple-workflows: ${typeof activities}.${activityType} is not a function`);
throw new Error(`simple-workflows: ${(activities.constructor?.name ?? typeof activities)}.${activityType} is not a function`);

Copilot uses AI. Check for mistakes.
@allanhvam allanhvam merged commit cc1002d into main Nov 4, 2025
1 check passed
@allanhvam allanhvam deleted the fix/undefined-activity branch November 26, 2025 08:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants