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

Handle asynchronous exceptions #51

Closed
jbpros opened this issue Mar 22, 2012 · 1 comment
Closed

Handle asynchronous exceptions #51

jbpros opened this issue Mar 22, 2012 · 1 comment
Assignees

Comments

@jbpros
Copy link
Member

jbpros commented Mar 22, 2012

Asynchronous exceptions are currently not caught: they interrupt Cucumber execution, print out the stack trace and end the process altogether.

It's possible to catch asynchronous exceptions on both Node.js and browsers through process.on('uncaughtException', ...) and window.onerror, respectively.

The catching function should call the current step callback.fail() function and pass it the caught exception so that Cucumber can report the failing step and proceed with the next scenario, if any.

Interesting Fact™: this will be the first piece of code in Cucumber.js that needs branching depending on wether it's running on Node or a browser.

@ghost ghost assigned jbpros Mar 22, 2012
@jbpros jbpros closed this as completed in 9091129 May 25, 2012
chirayuk added a commit to chirayuk/cucumber-js that referenced this issue Oct 4, 2014
See angular/protractor#876 (specifically [my
comment](angular/protractor#876 (comment))). 
Cucumber uses the top level uncaught error handler to catch exceptions
caught by tests.  Refer commit
cucumber@9091129
and issue cucumber#51.  A good approach would be to wrap the test code
executions in try/catch blocks and use that exception instead of the
`uncaughtException` handler.  Another approach is to use the error
handler of a nodejs domain instead of the top level global
uncaughtException handler.  In this commit, I'm using the domain level
error handler approach.
chirayuk added a commit to chirayuk/cucumber-js that referenced this issue Oct 4, 2014
See angular/protractor#876 (specifically [my
comment](angular/protractor#876 (comment))). 
Cucumber uses the top level uncaught error handler to catch exceptions
caught by tests.  Refer commit
cucumber@9091129
and issue cucumber#51.  A good approach would be to wrap the test code
executions in try/catch blocks and use that exception instead of the
`uncaughtException` handler.  Another approach is to use the error
handler of a nodejs domain instead of the top level global
uncaughtException handler.  In this commit, I'm using the domain level
error handler approach.
chirayuk added a commit to chirayuk/cucumber-js that referenced this issue Oct 4, 2014
See angular/protractor#876 (specifically [my
comment](angular/protractor#876 (comment))). 
Cucumber uses the top level uncaught error handler to catch exceptions
caught by tests.  Refer commit
cucumber@9091129
and issue cucumber#51.  A good approach would be to wrap the test code
executions in try/catch blocks and use that exception instead of the
`uncaughtException` handler.  Another approach is to use the error
handler of a nodejs domain instead of the top level global
uncaughtException handler.  In this commit, I'm using the domain level
error handler approach.
chirayuk added a commit to chirayuk/cucumber-js that referenced this issue Oct 4, 2014
See angular/protractor#876 (specifically [my
comment](angular/protractor#876 (comment))). 
Cucumber uses the top level uncaught error handler to catch exceptions
caught by tests.  Refer commit
cucumber@9091129
and issue cucumber#51.  A good approach would be to wrap the test code
executions in try/catch blocks and use that exception instead of the
`uncaughtException` handler.  Another approach is to use the error
handler of a nodejs domain instead of the top level global
uncaughtException handler.  In this commit, I'm using the domain level
error handler approach.
@lock
Copy link

lock bot commented Oct 25, 2018

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Oct 25, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant