Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve broker error handler types #1286

Merged
merged 2 commits into from
Jun 13, 2024

Conversation

shawnmcknight
Copy link
Member

📝 Description

The errorHandler option that can be supplied to the service broker options has loose type definitions for the info parameter. In one case it is defined as any, and in the other it is defined as GenericObject (i.e. Record<string,any>). The signature of the callers to the errorHandler is variable, but it falls into two distinct categories: when called from the error handler middleware and when called from other broker workflows. These results in two possible types for the info parameter.

This PR updates the type definitions to be more specific about the types for the info parameter for the broker's errorHandler option.

🎯 Relevant issues

None

💎 Type of change

  • New feature (non-breaking change which adds functionality)

🚦 How Has This Been Tested?

I patched these changes into my repository and then created a new error handler function which used the info parameter.

🏁 Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • I have commented my code, particularly in hard-to-understand areas

Copy link
Member

@icebob icebob left a comment

Choose a reason for hiding this comment

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

Great, thanks!

@icebob icebob merged commit 4f7787a into moleculerjs:master Jun 13, 2024
177 checks passed
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