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

fix: using default parameter to avoid runtime error #522

Merged
merged 1 commit into from
Dec 21, 2020

Conversation

helio-frota
Copy link
Member

This is a quick fix to avoid the following error when no action is passed in the constructor:

TypeError: Cannot read property 'name' of undefined

Related to #514

This is a quick fix to avoid the following error when no action is
passed in constructor:

TypeError: Cannot read property 'name' of undefined
@helio-frota helio-frota self-assigned this Dec 21, 2020
Copy link
Contributor

@mhdawson mhdawson left a comment

Choose a reason for hiding this comment

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

LGTM

@helio-frota helio-frota merged commit 6a6f08b into master Dec 21, 2020
@helio-frota helio-frota deleted the action-default-parameter branch December 21, 2020 16:44
Copy link
Member

@lance lance left a comment

Choose a reason for hiding this comment

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

The action parameter should be a function not object. However, personally I don't think a default action should exist as it makes no sense. In my opinion, a TypeError should still be thrown, but with an error message describing the problem. For example, "No action provided. Cannot construct a CircuitBreaker without an invokable action."

@helio-frota
Copy link
Member Author

I don't think a default action should exist as it makes no sense. In my opinion, a TypeError should still be thrown, but with an error message describing the problem. For example, "No action provided. Cannot construct a CircuitBreaker without an invokable action."

makes a lot of sense to me looking this way now. I'm going to create an issue for this.

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.

3 participants