Skip to content

Commit

Permalink
fix(prompt): should assign value when exists validate
Browse files Browse the repository at this point in the history
  • Loading branch information
imcuttle committed Sep 5, 2018
1 parent 19033e0 commit e2755fc
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/edam/src/core/promptProcessor/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,11 @@ export default async function prompt(
if (_.isFunction(validate)) {
let message = await validate(value, set, context)
if (typeof message === 'string') {
// value = prompt.default
throw new EdamError(`Validate ${JSON.stringify(prompt.name)} failed, error message: ${message}`)
}
return set
if (!message) {
throw new EdamError(`Validate ${JSON.stringify(prompt.name)} failed`)
}
}

Object.assign(set, {
Expand Down

0 comments on commit e2755fc

Please sign in to comment.