Skip to content

Commit

Permalink
Move comments
Browse files Browse the repository at this point in the history
  • Loading branch information
ehmicky committed Feb 20, 2022
1 parent f0b1d04 commit e9dbd1c
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/config/normalize/lib/call.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@ import { handleValidateError } from './validate.js'
// Most definition methods follow the same patterns:
// - Called with `value` and `opts`
// - Optionally async
// Errors add as suffix:
// - The current `value`
// - `definition.example`, if provided
export const callValueFunc = async function (userFunc, value, opts) {
try {
return await callWithValueFunc(userFunc, value, opts)
Expand All @@ -20,11 +17,13 @@ export const callValueFunc = async function (userFunc, value, opts) {
}
}

// Add the current value as error suffix
const addCurrentValue = function (error, value) {
const valueStr = serializeValue(value)
return wrapError(error, `\nCurrent value:${valueStr}`)
}

// Add an example value as error suffix, as provided by `example(value, opts)`
const addExampleValue = async function (error, value, opts) {
if (opts.example === undefined || !error.validation) {
return error
Expand Down

0 comments on commit e9dbd1c

Please sign in to comment.