From a071aabbb94247687949027e9b2cddda52d0d0cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aslak=20Helles=C3=B8y?= Date: Sat, 18 Feb 2017 21:01:05 +0000 Subject: [PATCH] Isolated try-catch --- src/runtime/step_runner.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/runtime/step_runner.js b/src/runtime/step_runner.js index 99289d9a6..2247a9571 100644 --- a/src/runtime/step_runner.js +++ b/src/runtime/step_runner.js @@ -8,10 +8,15 @@ const {beginTiming, endTiming} = Time async function run({attachmentManager, defaultTimeout, scenarioResult, step, stepDefinition, parameterRegistry, world}) { beginTiming() - let error, result + let error, result, parameters try { - const parameters = stepDefinition.getInvocationParameters({scenarioResult, step, parameterRegistry}) + parameters = stepDefinition.getInvocationParameters({scenarioResult, step, parameterRegistry}) + } catch(err) { + error = err + } + + if(!error) { const timeoutInMilliseconds = stepDefinition.options.timeout || defaultTimeout const validCodeLengths = stepDefinition.getValidCodeLengths(parameters) @@ -27,8 +32,6 @@ async function run({attachmentManager, defaultTimeout, scenarioResult, step, ste } else { error = stepDefinition.getInvalidCodeLengthMessage(parameters) } - } catch(err) { - error = err } const attachments = attachmentManager.getAll()