Skip to content

Commit

Permalink
fix: using default parameter to avoid runtime error (#522)
Browse files Browse the repository at this point in the history
This is a quick fix to avoid the following error when no action is
passed in constructor:

TypeError: Cannot read property 'name' of undefined
  • Loading branch information
helio-frota authored Dec 21, 2020
1 parent 4333478 commit 6a6f08b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/circuit.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ class CircuitBreaker extends EventEmitter {
return !!error[OUR_ERROR];
}

constructor (action, options = {}) {
constructor (action = {}, options = {}) {
super();
this.options = options;
this.options.timeout =
Expand Down

0 comments on commit 6a6f08b

Please sign in to comment.