catch errors thrown in onStepComplete() hook
Showing
1 changed file
with
3 additions
and
3 deletions
... | @@ -1337,13 +1337,13 @@ Casper.prototype.runStep = function runStep(step) { | ... | @@ -1337,13 +1337,13 @@ Casper.prototype.runStep = function runStep(step) { |
1337 | this.emit('step.start', step); | 1337 | this.emit('step.start', step); |
1338 | try { | 1338 | try { |
1339 | stepResult = step.call(this, this.currentResponse); | 1339 | stepResult = step.call(this, this.currentResponse); |
1340 | if (utils.isFunction(this.options.onStepComplete)) { | ||
1341 | this.options.onStepComplete.call(this, this, stepResult); | ||
1342 | } | ||
1340 | } catch (err) { | 1343 | } catch (err) { |
1341 | this.emit('step.error', err); | 1344 | this.emit('step.error', err); |
1342 | throw err; | 1345 | throw err; |
1343 | } | 1346 | } |
1344 | if (utils.isFunction(this.options.onStepComplete)) { | ||
1345 | this.options.onStepComplete.call(this, this, stepResult); | ||
1346 | } | ||
1347 | if (!skipLog) { | 1347 | if (!skipLog) { |
1348 | this.emit('step.complete', stepResult); | 1348 | this.emit('step.complete', stepResult); |
1349 | this.log(stepInfo + f(": done in %dms.", new Date().getTime() - this.startTime), "info"); | 1349 | this.log(stepInfo + f(": done in %dms.", new Date().getTime() - this.startTime), "info"); | ... | ... |
-
Please register or sign in to post a comment