Permalink
Browse files

catch errors thrown in onStepComplete() hook

  • Loading branch information...
n1k0 committed Dec 29, 2012
1 parent 6c72cc1 commit 8e107626789de98e791ba5b04f3946e32e6f7578
Showing with 3 additions and 3 deletions.
  1. +3 −3 modules/casper.js
View
@@ -1337,13 +1337,13 @@ Casper.prototype.runStep = function runStep(step) {
this.emit('step.start', step);
try {
stepResult = step.call(this, this.currentResponse);
+ if (utils.isFunction(this.options.onStepComplete)) {
+ this.options.onStepComplete.call(this, this, stepResult);
+ }
} catch (err) {
this.emit('step.error', err);
throw err;
}
- if (utils.isFunction(this.options.onStepComplete)) {
- this.options.onStepComplete.call(this, this, stepResult);
- }
if (!skipLog) {
this.emit('step.complete', stepResult);
this.log(stepInfo + f(": done in %dms.", new Date().getTime() - this.startTime), "info");

0 comments on commit 8e10762

Please sign in to comment.