Skip to content

Conversation

@regevbr
Copy link
Contributor

@regevbr regevbr commented Jul 15, 2018

Fix generator error handling (Fix #89)

When a generator's run emits an 'error' event, there is no handler for it, thus causing the application to crash.
In some cases the error is also passed to the callback of the run method, which can cause double handling of the error event.
The solution is to handle the event of the generator and call the callback with it, while ensuring the callback is only being called once.
If no callback was passed, keep backwards behavior and let the emitted error crash the application (as it is not handled). This is the expected behaviour when using the yo cli tool

@regevbr
Copy link
Contributor Author

regevbr commented Jul 15, 2018

@SBoudrias can you please check?
I added required tests and made sure the tests fails before the fix (as mentioned in the first comment it can fail in 2 ways - un handled error event or callback being called twice - both were reproduced and fixed)

@regevbr regevbr closed this Jul 17, 2018
@regevbr regevbr reopened this Jul 17, 2018
@regevbr regevbr closed this Jul 17, 2018
@regevbr regevbr reopened this Jul 17, 2018
@SBoudrias
Copy link
Member

Thanks!

@SBoudrias SBoudrias merged commit 78afb92 into yeoman:master Jul 17, 2018
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