Skip to content

Commit

Permalink
Handle single combination in measure errors
Browse files Browse the repository at this point in the history
  • Loading branch information
ehmicky committed Sep 19, 2021
1 parent c70492e commit 2d76041
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions src/run/measure/single.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { getCombinationName } from '../../combination/name.js'
import { getCombinationPrefix } from '../../combination/name.js'
import { startLogs, stopLogs, hasLogs } from '../logs/create.js'
import { addErrorTaskLogs } from '../logs/error.js'
import { startLogsStream, stopLogsStream } from '../logs/stream.js'
Expand Down Expand Up @@ -98,6 +98,8 @@ const handleStopAndMeasure = async function (args) {
return returnValue
}

// When an error happens while a measuring a specific combination, display its
// dimensions in the error message
const handleErrorsAndMeasure = async function ({
onTaskExit,
noDimensions,
Expand All @@ -106,14 +108,11 @@ const handleErrorsAndMeasure = async function ({
try {
return await Promise.race([onTaskExit, runEvents(args)])
} catch (error) {
prependMeasureError(error, args.combination, noDimensions)
const combinationPrefix = getCombinationPrefix(
args.combination,
noDimensions,
)
error.message = `${combinationPrefix}${error.message}`
throw error
}
}

// When an error happens while a measuring a specific combination, display its
// dimensions in the error message
const prependMeasureError = function (error, combination, noDimensions) {
const combinationPrefix = getCombinationName(combination, noDimensions)
error.message = `In ${combinationPrefix}:\n${error.message}`
}

0 comments on commit 2d76041

Please sign in to comment.