Handle asynchronous exceptions #51

Closed
jbpros opened this Issue Mar 22, 2012 · 0 comments

Comments

Projects
None yet
1 participant
Owner

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.

jbpros was assigned Mar 22, 2012

jbpros closed this in 9091129 May 25, 2012

@chirayuk chirayuk added a commit to chirayuk/cucumber-js that referenced this issue Oct 4, 2014

@chirayuk chirayuk Use nodejs domain error handler instead of uncaughtError handle
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 #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.
7b41668

@chirayuk chirayuk added a commit to chirayuk/cucumber-js that referenced this issue Oct 4, 2014

@chirayuk chirayuk Use nodejs domain error handler instead of uncaughtError handle
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 #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.
54c2590

@chirayuk chirayuk added a commit to chirayuk/cucumber-js that referenced this issue Oct 4, 2014

@chirayuk chirayuk Use nodejs domain error handler instead of uncaughtError handle
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 #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.
b708268

@chirayuk chirayuk added a commit to chirayuk/cucumber-js that referenced this issue Oct 4, 2014

@chirayuk chirayuk Use nodejs domain error handler instead of uncaughtError handle
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 #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.
0666d91
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment