Skip to content

Commit

Permalink
Isolated try-catch
Browse files Browse the repository at this point in the history
  • Loading branch information
aslakhellesoy committed Feb 18, 2017
1 parent e5f317e commit a071aab
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/runtime/step_runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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()
Expand Down

0 comments on commit a071aab

Please sign in to comment.