Commit 8e107626 8e107626789de98e791ba5b04f3946e32e6f7578 by Nicolas Perriault

catch errors thrown in onStepComplete() hook

1 parent 6c72cc1d
......@@ -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");
......